From Boldcore's wiki
Jump to: navigation, search

Openvswitch VXLAN Hello World example

This is very cool. You can create simple and efficient L2 ethernet tunnel between two hosts with L3 (IP) connection.
Later you can add physical interface to the ovs bridge, connect dumb physical L2 switch and interconnect two sites.

Open port on ffiewall

L2 Ethernet frames are encapsulated in L4 UDP datagrams. Port is 4789.

firewall-cmd --add-port=4789/udp --zone=public --permanent

Create virtual switch and VXLANs

ovs-vsctl add-br br0
ovs-vsctl add-port br0 vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip=192.168.80.30
ovs-vsctl add-port br0 vxlan0 -- set interface vxlan0 type=vxlan options:remote_ip=192.168.80.20

br0 is the virtual switch (bridge) where you can "plug" virtual and physical interfaces remote_ip is your server's public IP (private in this case, just for testing in LAB)

Create and connect internal virtual interface to vitual switch

ovs-vsctl add-port br0 vi0 -- set Interface vi0 type=internal
ip addr add 192.168.120.10/24 dev vi0
ifconfig vi0 up
ovs-vsctl add-port br0 vi0 -- set Interface vi0 type=internal
ip addr add 192.168.120.20/24 dev vi0
ifconfig vi0 up

Tesing

Try to ping each other's IP address of vi0. (192.168.120.10 and 192.168.120.20)