By creating an overlay network, you can have a new interface attached to your system with any arbitrary IP that you would like. You can also join other machines to this network and have connectivity between all of them using the overlay IPs. OVS is a multilayer virtual switch designed to enable massive network automation through programmatic extension. To create an overlay network, we need to create an internal interface. The internal interface is used because you may lose your connectivity when trying to build a bridge and connect your physical interfaces to it; since they would not get an IP (switches work in layer 2). Instead, the internal interface obtains an IP address, and the host would be accessible. Here, we create an overlay network between three VMs running on Virtual Box.
To install Open vSwitch please check their page. Alternatively, you can install ovs using apt-get in ubuntu by:
In an overlay network created by Openvswitch, all packets are encapsulated in UDP packets associated with the port 4789. So please ensure this port is accessible.
Here, we create a bridge named br-mng. An internal interface named intif and an interface of type vxlan are also created. Vxlan interface is used for point to point communication between two hosts. So the same key should be used for both hosts on each side of the connection. It should be noted that the MTU of the internal interface (intif) should be set to 1450. Since packets are encapsulated in UDP packets and the size of the payload is matter. There is a nice explanation here. Then we have:
And in VM #2 we have the same things. However, the underlay and overlay IP are changed correspondingly, but the key remains the same.
To ensure having proper connectivity, let’s see the status of interfaces of your VMs. We should have the overlay IP that we chose before and MTU of 1450 for intif.
We can also use iperf3 which is a tool for active measurements of the maximum achievable bandwidth. On VM #1 with overlay IP of 192.168.10.11 execute:
and on the VM #2 with overlay IP of 192.168.10.12:
Then you should see the following output:
If you see the transfer rate of 0 Byte, most likely there is a problem with the configured MTU of your interfaces.