Create an OpenVSwitch Bridge between several Proxmox servers via RPN

Proxmox allows to use virtual OpenvSwitch switches, providing you a very simple way to set-up more complex network configurations.

For example, you can enable all your VMs, hosted on different Proxmox hypervisors, to communicate with each other in the same subnet by using the RPN and an OpenVSwitch Bridge.

Installation

In a first step, you have to install the packages required to create the Bridge:

sudo apt-get install openvswitch-switch ethtool

Interface configuration

Now we have to edit the file /etc/network/interfaces.

We start with the configuration of eth1, which represents in our example the RPN interface:

auto eth1
iface eth1 inet dhcp
	mtu 9000

This configuration uses DHCP for RPN (recommended) and set the MTR to 9000.

Now we have to configure our Bridge, we call it vmbr1:

auto vmbr1
iface vmbr1 inet manual
        ovs_type OVSBridge
        post-up ovs-vsctl add-port vmbr1 gre0 -- set interface gre0 type=gre options:remote_ip=''RPNIP2''

This allows to create the Bridge on which we will install our VMs and configure the GRE tunnel between the two servers.
You will notice the mention RPNIP2 in the code above. This has to be replaced with the IP address of your other Proxmox host.

Set the same configuration on your two servers and take care about the setting of RPNIP2.

Once the server are configured, reboot them.

If you are running a firewall on either one of your hosts, it may block the traffic. To avoid this, load the nf_conntrack_pptp module by running the following command: echo nf_conntrack_pptp » /etc/modules

VM configuration

To enable the VMs to communicate with each other via the hypervisor, you need either to configure a dedicated network interface on them, or create them directly on the bridge.

In our case, we will create the VMs connected directly to the Bridge.

Don't hesitate to contact our documentation about Proxmox VE 4, in case you require more information.

Start by creating a new Container/VM by using the corresponding buttons:

Create your VM as usual, until you arrive at the network configuration.
Choose the Bridge on vmbr1 and a private IP address from a subnet of your choice.

Following an example:

Continue with the same operation on the other hypervisor, by using another IP of the same subnet.

Start your VMs.

Thats it. Your VMs are now able to communicate with each other using their private IPs!

Usage of OpenVSwitch on multiple Hypervisors

We have seen how to use OpenVSwitch between two servers.

To add it on three or more servers, you simply have to add the corresponding GRE tunnels in your network configuration:

ovs-vsctl add-port vmbr1 greX -- set interface greX type=gre options:remote_ip=''IPRPNX''

Increment the number of the GRE tunnel (Replace greX with gre1, gre2, gre3, etc …) and set the IPRPNX to the remote IP of your hypervisor on the RPN.