понедельник, 6 февраля 2012 г.

OpenVswitch GRE tunnel

For, example i have few virtual machines on my home server and several on my work server. I want that they lived in one distributed ethernet network.

OpenVswitch has implementation for GRE tunnels. In our case we will encapsulate all our ethernet traffic over IP.

My servers on Ubuntu 11.10.

Home server IP: 1.1.1.1
Work server IP: 2.2.2.2

On both servers install OVS (OpenVswitch). First install and automatically compile ovs module, then install main packages.

aptitude install openvswitch-datapath-dkms
aptitude install openvswitch openvswitch-brcompat
Then add brcompat_mod (replace for standart bridge utils) module.
modprobe brcompat_mod

ovs-brcompatd --pidfile --detach
Add ovs bridge and gre interface
ovs-vsctl add-br brs0
On work server:
ovs-vsctl add-port brs0 gre0 -- set interface gre0 type=gre options:remote_ip=1.1.1.1
On home server
ovs-vsctl add-port brs0 gre0 -- set interface gre0 type=gre options:remote_ip=2.2.2.2
Then you need to add tap interface of your VMs into the bridges
ovs-vsctl add-port brs0 vnet0
You don't need to add your uplink interface(eth0) to bridge. Now all VMs will live in single network. Note that GRE doesn't encrypt your traffic.