【Tutorial】PC share network to Zero via USB

Introduce a simple method to connect Zero to the internet.
Zero’s default kernel option set usb as a composite gadget: Serial and Ethernet.
You can share your PC’s network to Zero.

Connect Zero to PC(Linux) via usb cable.

The cable provide power and usb communication to Zero.
Ensure you can see usb0 port On PC&Zero

zp@ubuntu64:~$ ifconfig

usb0 Link encap:Ethernet HWaddr 66:36:e9:13:fd:44

root@Lichee:~# ifconfig

usb0 Link encap:Ethernet HWaddr 2e:cf:e1:3f:ad:61

ok, then set ip address manually:
on PC: sudo ifconfig usb0
on Zero: sudo ifconfig usb0

Test PC ping Zero:
zp@ubuntu64:~$ ping PING ( 56(84) bytes of data. 64 bytes from icmp_seq=1 ttl=64 time=2.74 ms 64 bytes from icmp_seq=2 ttl=64 time=2.19 ms ...

Everything is ok now, let’s edit network config(/etc/network/interfaces) to save it:
On PC add:

allow-hotplug usb0
auto usb0
iface usb0 inet static

On Zero add:

allow-hotplug usb0
auto usb0
iface usb0 inet static

Share Network from PC

Enable forwarding on your PC:

echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null
sudo iptables -P FORWARD ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE -s

test Ping google (if you are in china, ping baidu.com please…)
ping google.com

If everything goes ok, your Zero is online now~

You can ssh to Zero on your PC or any PC in the local net.

zp@ubuntu64:~$ ssh root@
root@’s password:
Linux Lichee 4.10.2-licheepi-zero+ #12 SMP Wed Mar 15 23:22:13 CST 2017 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Feb 15 23:39:33 2017 from

And you can execute any command on Zero via ssh.
Zero is used as a “headless” board now.

Very useful, however which one is the default image? Does mindb work?