export SB=$(docker exec openvswitch_vswitchd ovs-vsctl get open . external_ids:ovn-remote | sed -e 's/\"//g') export NB=$(docker exec openvswitch_vswitchd ovs-vsctl get open . external_ids:ovn-remote | sed -e 's/\"//g' | sed -e 's/6642/6641/g')
openstack network list openstack port list docker exec -it ovn_controller ovn-nbctl --db=$NB ls-list docker exec -it ovn_controller ovn-nbctl --db=$NB show caad04e9-6402-4dad-84ed-429e88dcab86
ovn-nbctl list Logical_Switch ovn-nbctl list Logical_Switch_Port ovn-nbctl list ACL ovn-nbctl list Address_Set ovn-nbctl list Logical_Router ovn-nbctl list Logical_Router_Port
ovn-sbctl list Chassis ovn-sbctl list Encap ovn-nbctl list Address_Set ovn-sbctl lflow-list ovn-sbctl list Multicast_Group ovn-sbctl list Datapath_Binding ovn-sbctl list Port_Binding ovn-sbctl list MAC_Binding
export SB=$(docker exec openvswitch_vswitchd ovs-vsctl get open . external_ids:ovn-remote | sed -e 's/\"//g') export NB=$(docker exec openvswitch_vswitchd ovs-vsctl get open . external_ids:ovn-remote | sed -e 's/\"//g' | sed -e 's/6642/6641/g') alias ovs-vsctl='docker exec openvswitch_vswitchd ovs-vsctl' alias ovs-ofctl='docker exec openvswitch_vswitchd ovs-ofctl' alias ovs-appctl='docker exec openvswitch_vswitchd ovs-appctl' alias ovs-dpctl='docker exec openvswitch_vswitchd ovs-dpctl' alias ovs-tcpdump='docker exec openvswitch_vswitchd ovs-tcpdump' alias ovn-sbctl='docker exec ovn_controller ovn-sbctl --db=$SB' alias ovn-nbctl='docker exec ovn_controller ovn-nbctl --db=$NB' alias ovn-trace='docker exec ovn_controller ovn-trace --db=$SB' alias ovn-appctl='docker exec ovn_controller ovn-appctl' alias ovn-detrace='cat >/tmp/trace && $containerTool cp /tmp/trace ovn_controller:/tmp/trace && docker exec -it ovn_controller bash -c "ovn-detrace --ovnsb=$SB --ovnnb=$NB </tmp/trace"' # https://lewisdenny.io/tracing_packets_out_an_external_network_with_ovn/ # https://lewisdenny.io/how_to_trace_packets_in_ovn/ # https://lewisdenny.io/ovs_ovn_command_cheat_sheet/
OVS
tcpdump br-int
Create:
1 2 3 4
ip link add name snooper0 type dummy ip link set dev snooper0 up docker exec -it openvswitch_vswitchd ovs-vsctl add-port br-int snooper0 docker exec -it openvswitch_vswitchd ovs-vsctl -- set Bridge br-int mirrors=@m -- --id=@snooper0 get Port snooper0 -- --id=@patch-tun get Port patch-tun -- --id=@m create Mirror name=mymirror select-dst-port=@patch-tun select-src-port=@patch-tun output-port=@snooper0 select_all=1
Listen:
1
tcpdump -i snooper0 -nn
Destroy:
1 2 3
docker exec -it openvswitch_vswitchd ovs-vsctl clear Bridge br-int mirrors docker exec -it openvswitch_vswitchd ovs-vsctl del-port br-int snooper0 ip link delete dev snooper0
tcpdump br-ext
Create:
1 2 3 4
ip link add name snooper1 type dummy ip link set dev snooper1 up docker exec -it openvswitch_vswitchd ovs-vsctl add-port br-ex snooper1 docker exec -it openvswitch_vswitchd ovs-vsctl -- set Bridge br-ex mirrors=@m -- --id=@snooper1 get Port snooper1 -- --id=@phy-br-ex get Port phy-br-ex -- --id=@m create Mirror name=mymirror select-dst-port=@phy-br-ex select-src-port=@phy-br-ex output-port=@snooper1 select_all=1
Listen:
1
tcpdump -i snooper1 -nn
Destroy:
1 2 3
docker exec -it openvswitch_vswitchd ovs-vsctl clear Bridge br-ex mirrors docker exec -it openvswitch_vswitchd ovs-vsctl del-port br-ex snooper1 ip link delete dev snooper1
tcpdump br-tun
Create:
1 2 3 4
ip link add name snooper2 type dummy ip link set dev snooper2 up docker exec -it openvswitch_vswitchd ovs-vsctl add-port br-tun snooper2 docker exec -it openvswitch_vswitchd ovs-vsctl -- set Bridge br-tun mirrors=@m -- --id=@snooper2 get Port snooper2 -- --id=@patch-int get Port patch-int -- --id=@m create Mirror name=mymirror select-dst-port=@patch-int select-src-port=@patch-int output-port=@snooper2 select_all=1
Listen:
1
tcpdump -i snooper2 -nn
Destroy:
1 2 3
docker exec -it openvswitch_vswitchd ovs-vsctl clear Bridge br-tun mirrors docker exec -it openvswitch_vswitchd ovs-vsctl del-port br-tun snooper2 ip link delete dev snooper2