Saturday, April 26, 2014

Configuring TP-LINK WR1043ND v2.1 as OpenFlow switch on OpenWRT


In my other post I provided details of compiling custom firmware for TP-LINK WR1043ND v2.1 to configure it as openflow enabled switch. In this post I detail the complete configurations to enable it as openflow enabled switch.

In my next post I will detail another configuration set along with openvswitch configuration details.

/etc/config/network

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

config switch_vlan
option device 'switch0'
option vlan '1'
option ports '0t 1'
option vid '1'

config switch_vlan
option device 'switch0'
option vlan '3'
option ports '0t 4'
option vid '3'

config switch_vlan
option device 'switch0'
option vlan '4'
option ports '0t 3'
option vid '4'

config switch_vlan
option device 'switch0'
option vlan '2'
option ports '5 6'
option vid '2'

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

config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config interface
option ifname 'eth1.1'
option proto 'static'

config interface
option ifname 'eth1.3'
option proto 'static'

config interface 'lan3'
option ifname 'eth1.4'
option proto 'static'

config interface 'lan4'
option ifname 'eth1.5'
option proto 'static'

config interface 'wan'
option ifname 'eth0'
option type 'bridge'
option proto 'static'
option ipaddr '10.0.0.2'
option netmask '255.255.255.0'
option gateway '10.0.0.1'
option broadcast '10.0.0.255'
option dns '10.0.0.1'

/etc/config/openflow

config 'ofswitch'
option 'dp' 'dp0'
option 'dpid' '000000000001'
option 'ofports' 'eth1.1 eth1.3 eth1.4 eth1.5 wlan0'
option 'ofctl' 'tcp:10.0.0.27:6633'
option 'mode'  'outofband'

/etc/config/wireless

config wifi-device  radio0
option type     mac80211
option channel  11
option hwmode 11ng
option path 'platform/qca955x_wmac'
list ht_capab LDPC
list ht_capab SHORT-GI-20
list ht_capab SHORT-GI-40
list ht_capab TX-STBC
list ht_capab RX-STBC1
list ht_capab DSSS_CCK-40
option htmode HT20
# REMOVE THIS LINE TO ENABLE WIFI:
# option disabled 1

config wifi-iface
option device   radio0
# option network  lan
option mode     ap
option ssid     OpenWrt-13-lan
option encryption none

config wifi-iface
option device   radio0
option network  wan
option mode     ap
option ssid     OpenWrt-13-wan
option encryption none

/etc/config/firewall

config defaults
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT


Reboot the router or restart network services after changing the configurations.

Here 10.0.0.1 is the my home gateway IP. Physically wan port on TP Link router is connected to one of the port on gateway.

/etc/init.d/openflow start

After starting the openflow service with above command, ofprotocol and ofdatapath should both be running on switch/router

To check: ps | grep of

Output:
 1522 root      1224 S    ofdatapath ptcp:6634 -i eth1.1 eth1.3 eth1.4 eth1.5
 1530 root      1020 S    ofprotocol tcp:127.0.0.1:6634 tcp:10.0.0.27:6633 --f

Compiled binaries:
Adding links to compiled binaries, which could be used directly with router in this post.
Binary for WR1043ND v2.1 with OF1 and USB packages.
Binary for WR1043ND v2.1 with OF1, USB and BRO packages.

References:
http://wiki.openwrt.org/toh/tp-link/tl-wr1043nd

No comments:

Post a Comment