Quick install how to for Installing and Configuring OpenvSwitch on Ubuntu 12.04 (Precise Pangolin) with the nightly OVS build. Before I start, I must point out the great progress the dev team has done in such a short time. All of the old gotchas in earlier releases on implementation are long gone. I am going to revisit the KVM integration in a few days as some of the inconsistencies for bringing up TAPs into hypervisors should be getting some consensus for provisioning.

The announcement of the inclusion of OpenvSwitch into the mainline Linux kernel, coupled with some KVM enhancements to provide VLAN tagging, LACP, QoS, sFlow etc, is making some of us excited ,and others very nervous.

For those familiar with the build you can just paste the following in your bash shell as root. To walk through the install skip the following snippet. The installation is extensively documented in the INSTALL file in the root of the tarball.

Open vSwitch Configuration

Run the following commands, note some dashes are two ‘- -‘ e.g. – -remote=db & – -private-key

Start ovsdb-server, this stores the config into a file that is persistent even after restarts.

Shell

1

2

3

4

5

6

ovsdb-server/usr/local/etc/openvswitch/conf.db\

--remote=punix:/usr/local/var/run/openvswitch/db.sock\

--remote=db:Open_vSwitch,manager_options\

--private-key=db:SSL,private_key\

--certificate=db:SSL,certificate\

--bootstrap-ca-cert=db:SSL,ca_cert--pidfile--detach--log-file

Shell

1

2

3

4

5

6

7

8

#Only need to run this the first time.

ovs-vsctl--no-waitinit

#Start vswitch

ovs-vswitchd--pidfile--detach

#Verify the kernel module(s) in case you didn&#039;t earlier and get errors.

#lsmod | grep br

#brcompat 13512 0

#openvswitch 98196 1 brcompat

If they are not there try loading again and check your path to the kernel module.

Shell

1

insmod datapath/linux/openvswitch.ko

At this point you have a fucntioning vanilla OVS install. Output should look something like this.

Shell

1

2

3

4

5

ovs-vsctl show

b6d574d7-5582-4cc0-93e5-a90cf0eb0a38

root@demo-139:/home/ubuntu/ovs-vxlan# ovs-vsctl --version

ovs-vsctl(Open vSwitch)1.8.90

Compiled Aug19201206:23:36

Configure Linux Networking

I have one NIC (eth1) on the same LAN segment/network/vlan.
We are attaching eth1 to br1 and applying an IP to the bridge interface.
We are attaching an IP to br2. br2 is the island that we are building a tunnel for hosts to connect on.

Shell

1

2

3

4

5

6

7

ovs-vsctl add-br br1

ovs-vsctl add-br br2

ovs-vsctl add-port br1 eth1

ifconfig eth10

ifconfig br1192.168.1.11netmask255.255.255.0

route add defaultgw192.168.1.1br1(br1 isnow the defaultgateway NIC instead of eth1 since we moved eth1 inside of br1(bridge interfacebr1)

If you have issues getting the bridge built you may need to kill the OVS processes and restart them depending on your step order.

Your Linux routing table should now look something like this:

Shell

1

2

3

4

5

6

root@openstack2:~# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref UseIface

0.0.0.0192.168.1.10.0.0.0UG000br1

10.1.2.00.0.0.0255.255.255.0U000br2

192.168.1.00.0.0.0255.255.255.0U000br1

You can put the following into a text file and give it execute permissions with “chmod +x filename” and then run it “./filename”. If your network settings are right it should flip the IP to the bridge and not cut you off. Keyword “should” so have a way to get to the box if you cut yourself off.

Shell

1

2

3

4

5

6

ovs-vsctl add-br br1

ovs-vsctl add-br br2

ovs-vsctl add-port br1 eth1

ifconfig eth10&amp;&amp;ifconfig br1192.168.1.(X)netmask255.255.255.0

route add defaultgw192.168.1.1br1

ifconfig br210.1.2.11netmask255.255.255.0

If you want your networking to be persistent over restart you can adjust /etc/network/interfaces similar to the following template.

I tend to just because it can get in the way with some things. If you install Ubuntu Server addition it wouldn’t be installed anywho. /etc/network/interfaces is the file the loads the config on a base intall. Not required but may get in the way.
Cyas.

Karthik Sharma04-05-2013

I have one NIC (eth1) on the same LAN segment/network/vlan.
We are attaching eth1 to br1 and applying an IP to the bridge interface.
We are attaching an IP to br2. br2 is the island that we are building a tunnel for hosts to connect on.

Does the above mean that before adding bridges using ovs-vsctl you have one ethernet interface eth1 with ip 192.168.1.1? I have a similar situation.but after the operations you suggested I can ping host and other machines in the host network but not google. (maybe DNS is trashed.??) any thoughts?

kjin04-14-2013

stop and purge the network-manager could become a nightmare. In my case, i lost network access completely. it toke me hours to recover from the disaster.

F604-29-2013

Hi Brent,

I am running my ovsdb-server on the TCP port and not on the unix server domain socket as discussed above. The problem I am facing is , I am unable to launch any VM. It is giving error “Connection Refused”. Any input?

Thnx

Michael05-27-2013

Hi,

I am trying to install openvswitch on ubuntu using this tutorial but I am struck in the COMPILING OPEN VSWITCH FROM SOURCE section at the following command:

./configure –with-linux=/lib/modules/uname -r/build

It says -r/build option doesn’t exist. When I remove the -r/build part from above command, it says no such directory exists. When I looked into the lib folder, there is no directory named modules inside the lib folder.

Just lemme know if that doesn’t work and I will verify it tonight.
Regards,
-Brent

Michael05-28-2013

It’s the same error coming up. I am using Ubuntu 12.10.

Michael05-28-2013

The command that worked for me is from opemvswitch Install readme file:

./configure –with-linux=/lib/modules/uname -r/build

bustam04-05-2014

Hi,
I am trying to install OpenVSwitch in the physical machine. Previously I have used the GENI testbed and in GENI VMs the above mentioned steps worked without any errors. But when I am trying to install the OVS in user space, then I am getting error when I am trying to “make”.
Then I tried with OVS-2.1.0., well with this everything is fine up to “make && make install”, when I am trying to insert the modules in the kernel its giving some error, (Unknown symbol in module). Do I need to insert the modules in the kernel? How to resolve this problem.
Thank you for your time.
Regards
Bustam

Ive noticed insmod doesn’t do the trick anymore but haven’t had time to poke around. I know this works on Fedora 19/20. Course you can install from package with yum / apt. Fedora is v2.x+. On ubuntu you can probably find a back port to 2.0 i would hope.

Thanks!
-Brent

Michael05-28-2013

Hi,

I am trying to install Openvswitch on Ubuntu 12.10 and when I used the second command of installing dependencies i.e.:

Hi Jun, I am getting the same thing. I noticed Ben Pfaff posted the same occourance last week. He is one of the lead devs on OVS so I would imagine there is a bug open but if not checking the OVS dev LSV might be warranted. I haven’t dropped back to an older build but may try.

Hi,
I am facing an issue. When my ovs try to connect to floodlight , there is no any problem.But in case of opendaylight,it tries to connect to it regularly, but fails. Can u please suggest the reasons?

I have just tried to install the openvswitch on the ubuntu 12.04.My ubuntu version is 12.04.4,I have tried openvswitch 1.9.*,openvswitch1.10.0,when I make it,the make program report error:”
/opt/openvswitch-1.9.3/datapath/linux/actions.c:104:2:error:too few arguments to function ‘_vlan_hwaccel_put_tag’
include/linux/if_vlan.h:236:31:note:declared here
/opt/openvswitch-1.9.3/datapath/linux/actions.c:In function ‘push_vlan':
/opt/openvswitch-1.9.’3/datapath/linux/action.c:124:2:error:too few arguments to function ‘_vlan_hwaccel_put_tag’
include/linux/if_vlan.h:236:31:note:declared here
the error reported by installing openvswitch 1.10.0 is the same.

leena04-22-2014

I am facing issues while installing openvswitch any versions…even after complete cleanup and things

db:Open_vSwitch,manager_options”: Invalid Syntax

Tried several installations but it doesn’t worked. Did anyone face issues??

Akash Rajguru04-23-2014

Hi Brent,

i just want to ask you that , can we configure OVS(OpenvSwitch) or any openFlow switch act as a router. and if yes how ?
i am doing my final semester university project on SDN , where i have to create topology using some openVswitches and using SDN controller make OpenvSwitch act as a router .
can you please share some idea on how i can achieve this Senior.

Pickle The Coding Kitty

Pickle the cat is sleepy after rolling some code for me. If anything here was helpful consider supporting some homeless kitties and click the picture and help save some furry friends today! http://www.alleycat.org/ or head to The Petition Site www.thepetitionsite.com and sign a few petitions to help prevent animal cruelty. It only takes a few clicks to help out!

Podcast Roll

If you would like me to list your tech podcast here please don’t hesitate to ping me. I am short on time these days and its hard to keep up.

Start Blogging Today

Start blogging, coding, Tweeting, labbing, anything that contributes to the community while improving yourself at the same time. Either way, no one is going to learn for you and you sure as hell don’t want to wait on some poseur middle manager or peer talking a big game at the expense of your career. Take control of your own future. So few careers equate hard work to reward like IT. Enough pep talking, get to it and change the world!

Feel free to use anything you find on the site that is useful as long as no kitties are harmed in the process