My Open vSwitch cheatsheet

Open vSwitch

Geting started

All documentation available on: Openvswitch.org. Here's good blog post about managing Open vSwitch via cli and connecting two remote host via VXLAN tunnel Networkstatic blog

VXLAN tunnel between two nodes

This script will build vxlan tunnel between two remote nodes and add flows to openvswitch bridges #option:key=flow = VNI number, flow - means no specific VNI

sh ovs-ofctl add-flows s1 flows.txt

# Do this on node1
sh ovs-vsctl add-port s1 vtep -- set interface vtep type=vxlan option:remote_ip=192.168.88.101 option:key=flow ofport_request=10

sh ovs-ofctl add-flows s1 flows.txt
#flows.txt
table=0,in_port=1,action=set_field:100->tun_id,resubmit(,1)
table=0,in_port=2,action=set_field:200->tun_id,resubmit(,1)
table=0,action=resubmit(,1)

table=1,tun_id=100,dl_dst=00:00:00:00:00:01,action=output:1
table=1,tun_id=200,dl_dst=00:00:00:00:00:02,action=output:2
table=1,tun_id=100,dl_dst=00:00:00:00:00:02,action=output:10
table=1,tun_id=200,dl_dst=00:00:00:00:00:01,action=output:10
table=1,tun_id=100,arp,nw_dst=10.0.0.1,action=output:1
table=1,tun_id=200,arp,nw_dst=10.0.0.2,action=output:2
table=1,tun_id=100,arp,nw_dst=10.0.0.2,action=output:10
table=1,tun_id=200,arp,nw_dst=10.0.0.1,action=output:10
table=1,priority=100,action=drop


# Do this on node2
sh ovs-vsctl add-port s1 vtep -- set interface vtep type=vxlan option:remote_ip=192.168.56.106 option:key=flow ofport_request=10

sh ovs-ofctl add-flows s1 flows.txt
#flows.txt
table=0,in_port=1,action=set_field:200->tun_id,resubmit(,1)
table=0,in_port=2,action=set_field:100->tun_id,resubmit(,1)
table=0,action=resubmit(,1)

table=1,tun_id=200,dl_dst=00:00:00:00:00:01,action=output:1
table=1,tun_id=100,dl_dst=00:00:00:00:00:02,action=output:2
table=1,tun_id=100,dl_dst=00:00:00:00:00:01,action=output:10
table=1,tun_id=200,dl_dst=00:00:00:00:00:02,action=output:10
table=1,tun_id=100,arp,nw_dst=10.0.0.2,action=output:2
table=1,tun_id=200,arp,nw_dst=10.0.0.1,action=output:1
table=1,tun_id=100,arp,nw_dst=10.0.0.1,action=output:10
table=1,tun_id=200,arp,nw_dst=10.0.0.2,action=output:10
table=1,priority=100,action=drop

Article3

Tokyo is the capital of Japan, the center of the Greater Tokyo Area, and the most populous metropolitan area in the world.