Saturday, May 3, 2014

Configuring TP-Link TL-WR740N v4.27 for OpenFlow and OpenWRT

In this post, I detailed the configurations required for TP-Link TL-WR740N v4.27 to work with OpenFlow. Basically four files needs to be changed and I have included below the configurations, which worked for me.

This example configuration is considering you would like to use WAN port as management port and LAN ports as OpenFlow ports. In such you will have to make sure controller is running in same network as WAN port is configured.

/etc/config/network

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 'fdaa:d16f:ceae::/48'

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 'lan1'
option ifname 'eth0.1'
option proto 'static'

config interface 'lan2'
option ifname 'eth0.2'
option proto 'static'

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

config interface 'lan4'
option ifname 'eth0.4'
option proto 'static'

config interface
option ifname 'wlan0'
option proto 'static'

config interface 'wan'
option ifname 'eth1'
option _orig_ifname 'eth1'
option _orig_bridge 'false'
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/wireless

config wifi-device  radio0
option type     mac80211
option channel  11
option hwmode 11ng
option path 'platform/ar933x_wmac'
list ht_capab SHORT-GI-20
list ht_capab SHORT-GI-40
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-10-lan
option encryption none

/etc/config/firewall

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

/etc/config/openflow

config 'ofswitch'
option 'dp' 'dp0'
option 'dpid' '000000000001'
option 'ofports' 'eth0.1 eth0.2 eth0.3 eth0.4 wlan0'
option 'ofctl' 'tcp:10.0.0.99:6633'
option 'mode'  'outofband'