openflow & openvswitch in openwrt

I’ve got a NetGear R6300 V2 in hand.

As you already know, installing openvswitch in openwrt is very simple now. But for openflow, you need rebuild the openwrt image.

Install openvswitch

In any openwrt system you can just do:

root@OpenWrt:~# opkg update
root@OpenWrt:~# opkg install kmod-openvswitch
root@OpenWrt:~# opkg install openvswitch
root@OpenWrt:~# ovsdb-tool create

To build the openflow supported openwrt, you need:

Build openwrt

OS: Ubuntu 14.04
Openwrt source: https://downloads.openwrt.org/chaos_calmer/15.05/bcm53xx/generic/OpenWrt-SDK-15.05-bcm53xx_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64.tar.bz2

Prepare your build env:

root@ubuntu# apt-get install build-essential binutils flex bison autoconf gettext texinfo sharutils subversion libncurses5-dev ncurses-term zlib1g-dev gawk git ccache
root@ubuntu# git clone https://github.com/CPqD/openflow-openwrt.git
root@ubuntu# tar xf OpenWrt-SDK-15.05-bcm53xx_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64.tar.bz2
root@ubuntu# cd OpenWrt-SDK-15.05-bcm53xx_gcc-4.8-linaro_uClibc-0.9.33.2_eabi.Linux-x86_64
root@ubuntu# ln -s openflow-openwrt/openflow-1.3/files
root@ubuntu# cd packages/
root@ubuntu# ln -s ~/openflow-openwrt/openflow-1.3/
root@ubuntu# cd ..
root@ubuntu# make menuconfig

Select the OpenFlow package under Network and build the image.

root@ubuntu# make -j4 V=s

Bugfix: gdbm build ERROR

$ make V=s package/gdbm/{clean,configure}
change prefix from "...buildbot..." to "/home/demo/OpenWrt..."
$ make V=s

屏幕快照 2015-12-01 上午12.41.59

屏幕快照 2015-12-01 上午10.18.25

屏幕快照 2015-12-01 上午10.16.45

屏幕快照 2015-12-01 上午2.02.02

屏幕快照 2015-12-01 上午1.10.52

files:

backup-OpenWrt-2015-11-30.tar

root@OpenWrt:~# ovs-vsctl show
ebcae155-3c74-4088-a0bd-1802438f7148
    Bridge "ovsbr0"
        Port "eth0.3"
            Interface "eth0.3"
        Port "ovsbr0"
            Interface "ovsbr0"
                type: internal
        Port "wlan0"
            Interface "wlan0"
        Port "eth0.4"
            Interface "eth0.4"
config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd6d:a096:2bef::/48'

config interface 'lan'
	option force_link '1'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option _orig_ifname 'eth0.1 radio0.network1'
	option _orig_bridge 'true'
	option ifname 'eth0.1'

config interface 'wan'
	option ifname 'eth0.2'
	option force_link '1'
	option proto 'dhcp'

config interface 'wan6'
	option ifname 'eth0.2'
	option proto 'dhcpv6'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '3 5t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '4 5t'

config switch_vlan
	option device 'switch0'
	option vlan '3'
	option ports '2 5t'

config switch_vlan
	option device 'switch0'
	option vlan '4'
	option ports '1 5t'

config switch_vlan
	option device 'switch0'
	option vlan '5'
	option ports '0 5t'

config interface 'port3_eth04'
	option proto 'none'
	option ifname 'eth0.4'
	option auto '1'

config interface 'port4_eth05_admin'
	option proto 'static'
	option ifname 'eth0.5'
	option netmask '255.255.255.0'
	option ipaddr '192.168.2.1'

config route

config interface 'port2_eth03_nm'
	option proto 'static'
	option ifname 'eth0.3'

config interface 'ovsbr0'
	option proto 'static'
	option ifname 'ovsbr0'
	option ipaddr '192.168.77.1'
	option netmask '255.255.255.0'
	option type 'bridge'

config interface 'wlan0'
	option proto 'none'
config wifi-device 'radio0'
	option type 'mac80211'
	option channel '11'
	option hwmode '11g'
	option path '18000000.axi/bcma0:7/pci0000:00/0000:00:00.0/0000:01:00.0/bcma1:1'
	option txpower '20'
	option country '00'

config wifi-iface
	option device 'radio0'
	option mode 'ap'
	option ssid 'OpenWrt-1'
	option key 'password'
	option encryption 'none'
	option network 'wlan0'
sleep 10
/etc/init.d/openvswitch restart

3 thoughts on “openflow & openvswitch in openwrt

  1. Hi, thanks for the post. I have a TP Link 1043ND v3. I have download the proper version of OpenWrt and replace the default fireware of the AP. Then ssh to the AP and install the OVS (opkg update && opkg install openvswitch). Do I still need to install OpenFlow on the AP or after the OVS is installed, it includes/includes openflow by itself? Thanks, Zhongliang

发表评论

您的电子邮箱地址不会被公开。