Introduction
This post is intended to describe the procedure of sharing internet over USB for PocketBeagle and BeagleBone black in Linux Hosts. PocketBeagle is an ultra-tiny-yet-complete open-source USB-key-fob computer. PocketBeagle features an incredible low cost, slick design and simple usage, making PocketBeagle the ideal development board for beginners and professionals alike.
PocketBeagle comes with a USB connectivity named Dual USB-Ethernet, by default has 192.168.7.2/192.168.6.2 as the ip address, which can be used to do Arduino like programming using Cloud9 IDE. In this tutorial we will be using 192.168.7.2 interface but can be applied to the second Ethernet as well.
This post is intended to help users to make use of USB networking of PocketBeagle to get access to the world of internet by network sharing from the host computer. The main advantage of using this approach is that users can get rid of the need for using long ethernet cables if the router is far away, or only Wifi network is available.
The Debian OS is used for the testing which is obtained from here.
PocketBeagle console can be got by using the following command
ssh 192.168.7.2 -l root
In the PocketBeagle, console type the following
ifconfig usb0 192.168.7.2
route add default gw 192.168.7.1
In the linux console of host system type
$ sudo su
#wlan0 is my internet facing interface, eth5 is the PocketBeagle USB connection
$ ifconfig eth5 192.168.7.1
$ iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
$ iptables --append FORWARD --in-interface eth5 -j ACCEPT
$ echo 1 > /proc/sys/net/ipv4/ip_forward
Incase network not accessible then type the following in BBB terminal
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
Note: Assuming that wlan0 of host system should be shared with USB-Ethernet eth5. User may change these configuration matching to their interface names.
Now the network can be accessed using the PccketBeagle….