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
Select “Internet sharing” and press “Ok”.
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.
ifdown eth0
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
ifup usb0
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.
Hi,
nice post, just wondering how one go about restoring the eth0 interface? I accidently borked my setup after resetting the firewall rules (
ifdown usb0
iptables-restore < original-rules.conf
!cut off from ssh session!
Now both LAN and WLAN are inaccessible (no dhcp leases any more, and manually setting old ip address on client wont work either, router is not responding). Only thing that is still up and running is the WAN web interface (which has no admin login).
I guess I have to use my recovery usb stick, but not sure what to look for. Any ideas?
/ Tomas
Hi Tomas,
If you have locked yourself out of your unit, the only way to fix this to use the rescue stick as you suggest yourself.
Log into the rescue system and mount the system partition I.e. mount /dev/sda1 /mnt or another appropriate location
When logged in, make sure you have no references onto usbX in your /etc/network/interfaces (Which should be found under your mount Ie. /mnt/etc/network/interfaces)
Also make sure that the (/mnt)/etc/network/firewall.conf does indeed have no references onto usb devices.
Then try rebooting the device.
/Tor