Monday, March 23, 2015

Close by, and blazingly fast - OpenWRT helps construct the WiFi infrastructure I should have had in the first place

While I was psyched to install OpenWRT on a TP-Link TL-WA850RE and produce the cutest / James-Bondiest device ever, I admit that it didn't have much practical value. I bought this device with the intention of boosting the WiFi signal emanating from the access point in our basement, but that didn't seem work. WiFi speeds were still unimpressive even after configuring the TP-Link.

Then, over the weekend, it hit me: to sidestep the issue with performance, I'm using a wired Ethernet drop for my work computers upstairs. What if I plugged the TP-Link device into my wired network, and then had it offer up an access point of it's own? If I did this, laptops upstairs would benefit from having a close proximity WiFi access point, yet the connection to the router in the basement would be over wires.

After some research, I realized that the desired configuration was pretty close to the stock configuration of OpenWRT. The key difference is that the default version of OpenWRT expects the outgoing network to be the wireless network (wan), not the wired network (lan). It took a bit of fiddling, but here's the working configuration:

# /etc/config/network
config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

# The "real" network
config interface 'lan'
        option ifname 'eth0'
        option force_link '1'
        option proto 'static'
        option ipaddr '192.168.1.75'
        option netmask '255.255.255.0'
        option dns '192.168.1.1'
        option gateway '192.168.1.1'


# The close proximity wireless access point 
config interface 'wan'
        option proto 'static'
        option ipaddr '10.0.0.1'
        option netmask '255.255.255.0'

# /etc/config/wireless
config wifi-device 'radio0'
      option type 'mac80211'
      option channel '5'
      option hwmode '11g'
      option path 'platform/ar934x_wmac'
      option htmode 'HT40-'
      option disable '0'
      option noscan '1'
      option txpower '20'

config wifi-iface
      option device 'radio0'
      option network 'wan'
      option mode 'ap'
      option ssid 'Pipsqueak'
      option encryption 'psk2'
      option key 'XXXXXXXXXXXXXXX'

# /etc/config/firewall
# ...
config zone
      option name             lan
      list   network          'lan'
      option input            ACCEPT
      option output           ACCEPT
      option forward          ACCEPT
      option masq             1       # CRITICAL

config zone
      option name             wan
      list   network          'wan'
      list   network          'wan6'
      option input            ACCEPT
      option output           ACCEPT
      option forward          REJECT

# Reversed from default config
config forwarding
      option src            wan
      option dest           lan
# ....

# /etc/config/dhcp
config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.auto'

config dhcp 'lan'
        option ignore '1'

config dhcp 'wan'
        option interface 'wan'
        option 'start' '50'
        option 'limit' '200'
        option 'leasetime' '1h'
        option ignore '0'

A configuration similar to the one above worked, however, initial WiFi performance was nothing particularly special. Thanks to various forum discussion I ended up tweaking txpower, noscan and a few other parameters before I got this impressive speed test:

Compared to the 4~5Mb/s I was getting, this is absolutely huge. This is just about the same performance I've been seeing over a wired connection.

I've got to say, I'm amazed. Who would have thought that I'd actually put this OpenWRT device to work? But no doubt about it, it's providing real value.

No comments:

Post a Comment