Skip to content

Standalone Linux server with Open vSwitch and GRE

Kohei Ichikawa edited this page Mar 9, 2016 · 12 revisions

Setup a standalone Linux server with Open vSwitch

Environment

A standalone Linux server can join the ENT environment using Open vSwtich and GRE tunneling links. The standalone server needs at least one public network interface. VMs on this server should have two interfaces, one for management and the other for ENT data plane. The interfaces for ENT data plane can be connected ENT backbone through Open vSwitch and GRE links. Standalone environment for ENT

Installing Open vSwitch on CentOS 6.7

Install prerequisites:

# yum install gcc make python-devel openssl-devel kernel-devel graphviz \
   kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \
   libtool python-six

If you do not have a directory, "${HOME}/rpmbuild/SOURCES", create the directory.

$ mkdir -p ${HOME}/rpmbuild/SOURCES

Download source code using git:

$ git clone https://github.com/openvswitch/ovs.git

In this document, we use source code of branch-2.4 as of March 8, 2016 (Commit hash: 3b18b0d690fd8e9d6158ce241128277caf848f0d).

$ cd ovs
$ git checkout branch-2.4
$ ./boot.sh
$ ./configure
$ make dist

Edit rhel/openvswitch.spec. Find the following line in rhel/openvswitch.spec, and remove --recheck option.

make check TESTSUITEFLAGS='--recheck'; then :;
->
make check TESTSUITEFLAGS=''; then :;

Run the following commands:

$ cp openvswitch-2.4.1.tar.gz ${HOME}/rpmbuild/SOURCES/
$ cp rhel/openvswitch-kmod.files ${HOME}/rpmbuild/SOURCES/
$ rpmbuild -bb rhel/openvswitch.spec
$ rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec

The above commands generate following RPM packages in ${HOME}/rpmbuild/RPMS/x86_64/.

  • openvswitch-2.4.1-1.x86_64.rpm
  • openvswitch-debuginfo-2.4.1-1.x86_64.rpm
  • kmod-openvswitch-2.4.1-1.el6.x86_64.rpm

Install Open vSwitch packages:

# cd /path/to/rpmbuild/RPMS/x86_64/
# rpm -ivh openvswitch-2.4.1-1.x86_64.rpm \
   openvswitch-debuginfo-2.4.1-1.x86_64.rpm \
   kmod-openvswitch-2.4.1-1.el6.x86_64.rpm

Start Open vSwitch service:

# service openvswitch start

Configuration of Open vSwitch Bridge

Add an Open vSwitch bridge

Add a bridge device on the host. tcp:xxx.xxx.xxx.xxx:xxxx needs to be replaced with an OpenFlow controller address and port. (To connect to a controller in ENT, ask the ENT operators about the address and port)

# ovs-vsctl add-br br0
# ovs-vsctl set-fail-mode br0 secure
# ovs-vsctl set bridge br0 protocol=OpenFlow10
# ovs-vsctl set-controller br0 tcp:xxx.xxx.xxx.xxx:xxxx

Configuration of GRE links

Open GRE protocol on firewall. Following commands just open firewall for GRE on your host. Your organization firewall may also block GRE protocol. Please make sure that your organization also opens the firewall for GRE. You might want to edit the configuration file for iptables and apply the following rules permanently.

# iptables -A INPUT -p gre -j ACCEPT
# iptables -A OUTPUT -p gre -j ACCEPT

Add GRE links to the other sites. The following commands create GRE interfaces named gre-xxxx (where xxxx is site name). As for remote_ip addresses, ask the ENT operators.

# ovs-vsctl add-port br0 gre-naist -- set interface gre-naist type=gre options:remote_ip=xxx.xxx.xxx.xxx
# ovs-vsctl add-port br0 gre-ucsd -- set interface gre-ucsd type=gre options:remote_ip=xxx.xxx.xxx.xxx
...

Attach a VM to the Open vSwitch bridge

Edit libvirt XML configuration of a target VM and add a new interface to be connected vSwitch. vm-name needs to be replaced your VM's name.

# virsh edit <vm-name>

Then, add the following lines after the other interface configuration:

<interface type='bridge'>
  <source bridge='br0'/>
  <virtualport type='openvswitch' />
  <model type='virtio'/>
</interface>

Restart your VM and you will find a new interface connected to br0.

Clone this wiki locally