My cable internet has been horrid lately. I wanted to be able to hotspot to my phone while maintaining LAN connections to my servers while the cable company takes its sweet time to fix things. Even though I connected to wifi on my phone, my desktop still prioritized the broken connection and wouldn’t use my phone to get to the internet. I verified this by looking at the routing table and running traceroute
sudo ip route
default via 10.137.1.1 dev br0 proto dhcp src 10.10.1.124 metric 425
default via 18.104.22.168 dev wlp69s0 proto dhcp src 22.214.171.124 metric 600
traceroute google.com --max-hops=1
1 _gateway (10.10.50.1) 0.409 ms 0.449 ms 0.483 ms
The LAN connection’s default gateway had a lower metric than the mobile hotspot connection (lower takes precedence.) To fix this I ran this networkmanager command (thanks to this post for the inspiration)
sudo nmcli connection modify "Nicholas’s iPhone" ipv4.route-metric 50
I noticed DNS traffic was also prioritizing my LAN, which I didn’t want. I fixed it with nmcli as well (thanks to this post)
sudo nmcli connection modify "Nicholas’s iPhone" ipv4.dns-priority 1
I then noticed I couldn’t get to certain LAN subnets. I then realized I needed to add some static routes so they don’t try to go over my hotspot connection (which I learned about here)
sudo nmcli connection modify bridge-br0 +ipv4.routes "10.10.50.0/24 10.10.1.1"
Note you may need to refresh your connection once you’ve made changes. You can either disconnect and reconnect to force a refresh, or run this command (as outlined here.)
sudo nmcli con up bridge-br0 #or whatever your LAN interface name is
Once I refreshed my settings, I was able to get internet via my phone while maintaining all my local network settings.
My parents’ ASUS RT-16N has been running dd-wrt for years now. I recently enhanced it with optware but something went horribly wrong after a few days. A drive out to their house revealed that the whole unit had spontaneously reset itself to factory defaults.
OpenWRT has come a long way since I last investigated it. I decided to give it another try as it’s till actively being developed whereas dd-wrt is not.
The wiki article on this device is a little bit out of date. I had to update it a little bit to get it to work.
To install OpenWRT on this device, SSH into it and run the following commands:
wget http://downloads.openwrt.org/barrier_breaker/14.07/brcm47xx/generic/openwrt-brcm47xx-generic-squashfs.trx mtd -r write
That part went smoothly. The last part to configure was wireless N. After some searching I came across this post on the OpenWRT forums which worked nicely for me. SSH into the router and do the following to enable full wireless N functionality:
opkg install kmod-brcmsmac
opkg install kmod-brcmutil
# make sure to delete the old config files ... you have to ...
rm -f /etc/config/wireless
wifi detect > /etc/config/wireless
Now comment out # "option disabled 1"
I had to take navid’s steps a little bit further by tweaking /etc/config/wireless a bit to add some features. My working wireless configuration is below:
config wifi-device 'radio0'
option type 'mac80211'
option channel '11'
option hwmode '11ng'
option path 'bcma0:0'
list ht_capab 'GF'
list ht_capab 'SHORT-GI-20'
list ht_capab 'SHORT-GI-40'
option txpower '19'
option country '00'
option device 'radio0'
option network 'lan'
option mode 'ap'
option ssid 'SSID'
option encryption 'psk2'
option key 'SSIDKEY'
Success! Fully functional OpenWRT on my parents’ Asus RT-16N.