As a software company, it is useful to use Open vSwitch for cloud networking. This post contains detailed steps and information on how to build and configure Open vSwitch.To run Open vSwitch, the Linux kernel version has to be 2.6.32 or higher. Currently, OpenWrt trunk r43236 has a kernel version 3.10.58 and Open vSwitch version 2.3.0. Keep checking for updates for both of them.

More on Open vSwitch:
More on OpenWrt:

[See Also: Virtualization in Custom Software Development and Testing]

Flashing OpenWrt On Your Device

The latest build image of OpenWrt can be downloaded here. This download link provides pre-built images for different platforms; you need to choose one specific to your device. There are different ways to flash the router. To learn how to flash image specific to your device, click here. Select your device from the list of supported devices to find the detailed procedure on how to flash your hardware. It will take few minutes to complete. Once you finish the flashing, you need to set IP of your host as 192.168.1.x. If the static protocol and DHCP protocol are set, the router will automatically assign the IP address in the range of 192.168.1.x.

Enabling Web Interface and SSH Access

By default, Luci (Web interface) is not installed and the root password is not set, so it is not possible to access the system through SSH. To enable these features, follow these steps:

  • Step 1: Telnet to your device to login to your device’s terminal.

$ telnet

  • Step 2: Set root password. Enter new password and confirm.

root@OpenWrt:~# passwd

  • Step 3: Install Luci from the default package manager (optional if your router does not have enough flash). You need Internet connection to execute the following steps.

root@OpenWrt:~# opkg update
root@OpenWrt:~# opkg install luci

Installing Open vSwitch

There are two methods to install Open vSwitch:

Installation using default package manager

Open vSwitch package is available on OpenWrt repository. To install Open vSwitch you need to delete the and its soft link provided by gcc as Open vSwitch package is also tries to install and fails because it could not create soft link.

  • Step 1: Delete and soft link.

root@OpenWrt:~# cd /lib
root@OpenWrt:~# rm*

  • Step 2: Install Open vSwitch.

root@OpenWrt:~# opkg install openvswitch

To verify if Open vSwitch is installed correctly, the output must show that ‘ovsdb-server’ and ‘ovs-vswitchd’ daemon are running.

root@OpenWrt:~# ps w | grep ovs

Installation by selecting Open vSwitch while building Image from source

  • Step 1: Use the direct download source. (Choose one of the two below).

$ git clone git://
$ svn co svn://

  • Step 2: Change directory to openwrt and update and install feeds.

$ ./scripts/feeds update -a

$ ./scripts/feeds install -a

  • Step 3: Configure .config file using menuconfig.

$ make menuconfig


 Select Target System. This gives you the target hardware details, for example Atheros AR7xxx/AR9xxx.


The Subtargtet is specific to your device.


Select Kernel modules, then Network Support, then kmod-tun.


Then from Network, select openvswitch.


$ make kernel_menuconfig

Select the package. Networking Support, then Networking Options, then Hierarchical Token Bucket (HTB)


  • Step 4: Start the compilation. This will take few hours depending upon your machine’s configuration. Press option – j on the keyboard to speed up the compilation process (optional).This process needs Internet connection to download packages.

$ make

  • Step 5: Once the compilation is done, the compiled image can be found at bin/ directory inside openwrt (parent) directory. Select the image specific to your device and follow the steps mentioned in the sections “Flashing OpenWrt to your device” and “Enabling Web Interface and SSH access.”
  • Step 6: Verify if Open vSwitch installed correctly.

root@OpenWrt:~# ps w | grep ovs

Configuring Open vSwitch

  • Step 1: Configure interfaces. If router has more than one ports, by default all are connected on a single LAN. To turn it into a soft switch, you need to separate all ports from LAN and WLAN. (I have separated only wlan0 and wlan1 as my intention is to connect hosts wirelessly.) Here is snapshot of my /etc/config/network file:


  • Step 2: Enable the wlan0 and wlan1 interfaces, by default wlan0 and wlan1 interfaces are disabled.

root@OpenWrt:~# ifconfig wlan0 up
root@OpenWrt:~# ifconfig wlan1 up

  • Step 3: Create a bridge using ovs-vsctl.

root@OpenWrt:~# ovs-vsctl add-br br-wlan0

  • Step 4: Add ports to the bridge.

root@OpenWrt:~# ovs-vsctl add-port br-wlan0 wlan0
root@OpenWrt:~# ovs-vsctl add-port br-wlan0 wlan1

  • Step 5: Set the controller. Here IP is IP address of the host on which controller is running. Port shows what controller is listening (default is 6633).

root@OpenWrt:~# ovs-vsctl set-controller br-wlan0 tcp:IP:PORT

  • Step 6: Verify the configuration.

root@OpenWrt:~# ovs-vsctl show

output should look like:

root@OpenWrt:~# ovs-vsctl show
Bridge "br-wlan0"
Controller "tcp:"
is_connected: true
Port "wlan1"
Interface "wlan1"
Port "wlan0"
Interface "wlan0"
Port "br-wlan0"
Interface "br-wlan0"
type: internal

If your controller has not started yet, the output above will not show. Start your controller and again check if the “ovs-vsctl show” output. If the output “is_connected: true” shows, the controller is now connected.

Verifying OpenFlow enabled Soft-switch with OpenDaylight

  • Step 1: Connect hosts to wlan.
  • Step 2: Check if the controller shows the switch and the connected hosts. Here is a snapshot of the controller:
  • Step 3: Ping from connected host1 to connected host2. It should work.
  • Step 4: Create a flow in controller with the Drop action and install flow. Now ping should not happen. You can test different scenarios with different flow entries.
As a software engineer, you can now put this knowledge on software development services to enhance your cloud networking.

Everything you need to know about outsourcing technology development
Access a special Introduction Package with everything you want to know about outsourcing your technology development. How should you evaluate a partner? What components of your solution that are suitable to be handed off to a partner? These answers and more below.

Introduction Package

Zymr blogger, Zymr, Inc.


Leave a Reply