Hello all,
I have an ubuntu 14.04.5 LTS X32 server that is running KVM/virtmanager with 2 VMs.
I need all traffic on the box to be mirrored to an interface on one of my VMs.
I installed Openvswitch and created bridge ovsbr0 with it. I setup eth0 to use ovsbr0.
I went into virt-manager and changed the nic to "specify shared device name" and the bridge was set to "ovsbr0". On VM start, I observe port vnet0, vnet1, and vnet2 created and attach to the bridge. (output below)
admin@ubuntu:~$ sudo ovs-vsctl show
xxx-xxx-xxx-xxx
Bridge "ovsbr0"
Port "vnet1"
Interface "vnet1"
Port "vnet2"
Interface "vnet2"
Port "eth0"
Interface "eth0"
Port "ovsbr0"
Interface "ovsbr0"
type: internal
Port "vnet0"
Interface "vnet0"
ovs_version: "2.0.2"
I was then able to create a rule in openvswitch using the following command to bridge all traffic to one of those ports.
sudo ovs-vsctl -- set Bridge ovsbr0 mirrors=@m -- --id=@eth0 get Port eth0 -- --id=@vnet0 get Port vnet0 -- --id=@vnet1 get Port vnet1 -- --id=@vnet2 get Port vnet2 -- --id=@m create Mirror name=pvsintfmirror select-dst-port=@vnet0,@vnet1,@eth0 select-src-port=@vnet0,@vnet1,@eth0 output-port=@vnet2
The mirroring worked but my issue is that on reboot, the VM interfaces seem to get assigned to those vnet ports randomly. Thus, the mirroring rule breaks if the wrong VM interface gets assigned to the wrong port.
If anyone knows how to ensure that the right interface connects to the vnet2 port so that mirrored traffic flows correctly, that would be a big help.
Thanks