You are here

howto: setup a tethered router network aka internet connection for laptop via pc via android phone

it came to pass on one cold, snowy night that internet access from only one compute was no longer sufficient. i needed to put my old laptop on the internet too. however, my internet source was my t-mobile android phone. yes, i tether my pc or laptop to get on the internet. this brings up an interesting scenario because the android phone's usb cable has to go into a usb port, either on the laptop or the pc.

so there are 3 devices in this network

  1. the android phone - through which flows the internet tubes
  2. the linux pc - which will be the router for the laptop
  3. the laptop

and on the linux pc there will be the following interfaces:

  1. usb0
  2. eth0

the solution apparently is really old and has been around for a while

1. in /etc/sysctl.conf change the line to result in

net.ipv4.ip_forward = 1

2. add the following rule to your iptables


the command for that is

iptables -A POSTROUTING -o usb0 -j MASQUERADE

then save it with

/etc/init.d/iptables save

3. set up a dhcp server (optional)

chkconfig dhcpd on

create /etc/dhcp/dhcpd.conf with the following contents:

ddns-update-style interim;
default-lease-time 21600;
max-lease-time 43200;

        option routers        ;
        option broadcast-address;
        option subnet-mask    ;
        option domain-name-servers;

        subnet netmask {

        subnet netmask {

        subnet netmask {

some explanation is required here.
the authoritative command is commented out because the android phone has a dhcp server on it. so you cant have 2 authoritative servers on the same network.

eth0 ip on the linux pc is statically set at via system-config-network
the dns (domain-name-server) is the android phone at i havent experimented to see if this a static ip or from the dhcp server on the phone.

for the eth0 subnet i gave it a range of 21 ips to use. from to

the subnet is used by the usb0. it is declared only to avoid unnecessary messages and errors in the logs.

the subnet is used by kvm and is declared for the same reason.

hmm..would an usb hub work? let me know in the coments section.