So my ADSL modem decided to take it’s last breath this weekend. After a brief conversation with my ISP support the modem was diagnosed to be no more. (They should send me a new modem replacing the old one. Hopefully this will arrive shortly)
So what should one do then. No Internet is certainly no option for me. I start to suffer from severe information shortage in a matter of hours. To remedy this my first thought was to connect my Android phone to my Laptop and thus at least get out on the net again. This works really great since the Android OS publish itself as an USB network device when plugged into a computer via USB. Unfortunately, since most of my Internet infrastructure is centered around a few Bubba units, nothing more than pure surfing worked when these units where offline.
Then it struck me, why not connect my phone to the B3 that currently is my router instead using the phones network to provide my home LAN with Internet connectivity, at least when I’m at home then 😀
Said and done this turned out to be a quite easy task. This is how I did it.
Start by connecting the USB cable between the phone and the USB port on B2/B3(Bubba).The phone then should show a selection box
Log in to your Bubba via SSH and become root. Then save the current firewall rules into a temporary file:
iptables-save > original-rules.conf
This will contain the current setting with references to the eth0 ethernet WAN interface. We save these to be able to change the settings back.
cp original-rules.conf usb-rules.conf
Then we edit the usb-rules file and change all occurrences of eth0 to usb0
sed -i "s/eth0/usb0/g" usb-rules.conf
For convenience add the usb0 interface to the network configuration. Add the following line to the file /etc/network/interfaces
iface usb0 inet dhcp
Then pick down the current eth0 device if up and running.
If you like, unplug the wan cable as well. Then apply the USB firewall rules by issueing
iptables-restore < usb-rules.conf
Then finally pick up the USB network interface by running
If all goes well you should now be running the Android phone as the primary WAN interface on Bubba. And since we use this Bubba as a router all devices attached to the LAN interface or via Wlan should be able to use Internet via the phone transparently.
To restore functionality disconnect the phone and reattach the wan cable again. You might have to do an ifup/down on the eth0 interface as well.