First off let me explain the problem I'm trying to solve:

I have an Android 2.2 phone that tethers its internet connection through USB to a laptop running Ubuntu 10.10. What I want to do is share this internet connection through an ethernet cable with another laptop running Ubuntu 10.10.

I've been looking on the internet but I haven't seen any cases of anyone else trying to to do this. If anyone knows of any resource for this, please let me know.

I believe that I have gotten it the devices to communicate one way via ping but I cannot go the other way. This is where I believe the internet connection is getting blocked.

How I did this was through Firestarter, which uses NAT, installed on the machine the phone is plugged into and using the following guide: http://www.fs-security.com/docs/connection-sharing.

Basically, the interface that is giving the connection is usb0 and I'm trying to share the connection through eth0. I basically just followed the above guide, replacing the instances of eth0 with usb0 an etho1 with etho0. The only thing it says to do that I'm not able to do is to enable DHCP on the Android phone, because frankly I don't know how.

I manually configured the network instead of using Firestarter's DHCP option because I'm hoping to ultimately not have to use firestarter to do this.

To be more specific, this is what I did: through the GUI Network Connections:

On the first laptop (the one connected to the phone)

IP address: Netmask: Default gateway (IP):

On the second latop, again through Network Connections: IP address: Netmask: Default Gateway: *My /etc/resolv.conf file actually doesn't show anything so that may be a problem.

*Also I just tried to share my wireless connection through ethernet through Firestarter and that didn't work either. I can ping between the two laptops but I can't get internet.

At the bottom, it tells how to test the setup. I can ping like it says in the guide and get a response. However, I can't go to google.com on the laptop thats supposed to be getting the shared connection. In addition, on the 2nd laptop, I can ping to the phone. However, I can't ping from the phone to the 2nd laptop. This is why I believe I can't get to the internet.

I'm at a loss for what I need to do to get this connection to work. Do I need to brige the connection between usb0 and eth0 on the latop the phone is connected to? or is that what Firestarter is already doing?

**Side note: I cannot ping from the 2nd laptop to the phone if I turn Firestarter off on the machine it is running on.

If anyone has an idea of how to get this working, it would be greatly appreciated.

  • 1) If your /etc/resolv.conf is empty, you can't access google.com or any other host by DNS name. Try to ping IP address. Copy nameserver addresses from the first computer to the second one first. Also maks sure your 1st laptop has forwarding enabled (use "sysctl net.ipv4.ip_forward" to check and "sysctl -w net.ipv4.ip_forward=1" to enable)
    – Cougar
    Mar 14, 2012 at 9:58

2 Answers 2


These steps are kind of low-level and can be automated using, for example, NetworkManager on current GNOME 3 distributions. However, here are lower level instructions that should work across a wide variety of Linux distributions and versions:

Step 1: Get the usb0 internet connection working fine on the box that's directly connected by USB to the phone.

Step 2: Plug in the ethernet cable between the computers.

Step 3: Use the following commands on the host computer, as root, or wrap in sudo:
ifconfig eth0 (or choose your own IP address within the designated LAN IP segments
ifconfig eth0 netmask

Step 4: Use the following commands on the client computer (the one that doesn't currently have an internet connection), as root, or wrap in sudo:
ifconfig eth0 (the first three numbers should be the same; the last one should be different, from the private IP of the host computer)

ifconfig eth0 netmask

Step 5: Adapted from here, execute these steps as root or wrap in sudo on the host computer:
echo 1 > /proc/sys/net/ipv4/ip_forward

/sbin/iptables -t nat -A POSTROUTING -o usb0 -j MASQUERADE

/sbin/iptables -A FORWARD -i usb0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

/sbin/iptables -A FORWARD -i eth0 -o usb0 -j ACCEPT

If you have existing settings (such as whatever Firestarter did) you may have to flush your iptables on the host, before executing step 5:

iptables -F

You can check your existing settings using

iptables -L

Finally: You probably already have a private IP address on a LAN from your usb0 connection. You may not use the same IP subnet for your NAT on the eth0 NAT. So if your usb0 has, you can't use anything from 192.168.0.x on eth0 on either computer.


Do you have to tether through USB? If Wifi is available on at least one computer then you should be able to create a Wifi AP in Android, connect with wifi on one of the laptops and then connect the two laptops together with ethernet. Configure the "middle" laptop to route traffic through its wifi connection. For example, in windows you would configure the adapter for internet connection sharing.

None of what I mention above will work with USB tethering which is why you would be better off to switch to WiFi.

  • There's nothing about ethernet that would make this impossible or hard to do with ethernet that would make it easier with wifi, aside from the absence of cables... wifi is certainly viable, but using a computer as a "host" via ethernet is fine. Sep 13, 2012 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy