When porting Ubuntu to a new platform, making adb work is one important step to achieve. Bringing up a full networking stack might be difficult, so if you want the convenience of networking on the phone before enabling the wifi chips, you can use the following steps to have your phone use your laptop's internet connection via adb.

This is similar to reverse tethering.

ensure ppp is enabled on host and target kernel


This might not be the minimal set, but it works.

install ppp on both host and target

You will need both the ppp and libpcap0.8 packages.

On host

sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -I POSTROUTING -s -j MASQUERADE -o eth0 # replace eth0 to the device node used on your host
sudo iptables -I FORWARD 1 --in-interface ppp0 -j ACCEPT
sudo iptables -I INPUT 1 --in-interface ppp0 -j ACCEPT

sudo adb ppp "shell:pppd nodetach noauth noipdefault defaultroute /dev/tty" nodetach noauth noipdefault notty

This will create network devices ppp0 on both host and target.

In the commands above, you will create a new private network between the host and the target, where the host ppp0 device will be assigned address and the target ppp0 device will have You may select different addresses if your host already uses the 192.168.0.x range.

You can verify the ppp0 devices exist on both host and target by issuing ifconfig.

Set DNS on target

echo nameserver >> /etc/resolv.conf

"" is Google nameserver, replace by any nameserver you want to use.

After all those steps, your phone has full internet access.

Final steps

If you mount root filesystem as RW by mount -o rw,remount /, you will be able to do something like apt-get install gdb, which will make it much easier to do development.

Then you can do something like "apt-get update ; apt-get install gcc" to do compile or something.

Touch/AdbNetworking (last edited 2014-11-26 06:50:59 by ycheng-twn)