I am using openvswitch to mirror traffic coming in or going out of a VM interface. Traffic is mirrored to output-port and could capture the packets on the output-port.
Was using the following command to create mirror
ovs-vsctl add-port br-int vxlan0
-- set Interface vxlan0 type=vxlan
options:local_ip= options:remote_ip=
options:key=25 option:dst_port=4789
-- --id=@p get port vxlan0 -- --id=@p1 get Port tap2
-- --id=@m create mirror name=mirr0 select_dst_port=@p1
select_src_port=@p1 output-port=@p -- set bridge br-int mirrors=@m
Mirroring does work fine until VM is rebooted. But once the VM is rebooted mirroring doesn't work. Mirroring works only when the src-interface is once again added to mirror.
Root cause is that OVS removes the src-interface of the mirror during reboot and doesnt add it back.
sudo ovs-vsctl list mirror mirr0
select_dst_port : [8d5554bb-e6c0-447c-922c-9fc0227b00b8] select_src_port : [8d5554bb-e6c0-447c-922c-9fc0227b00b8]
After reboot
sudo ovs-vsctl list mirror mirr0
select_dst_port : [] select_src_port : []
Is there a way to make OVS mirror work persistent across reboots.
Ubuntu version
Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic