Saturday, May 9, 2015

Sharing Internet with the BeagleBone Black over its usb network interface

Here is the scenario:

* My Ubuntu computer has access to the Internet through wifi (wlan0).

* I connect my BeagleBone Black to my host computer using the usb cable, and the usb network is on.

* The ip addresses of the usb network connection are:

+ Ubuntu computer:
+ BeagleBone Black:

* But when I log into the BBB, it cannot go out to the Internet.

So, I will attempt to share my Ubuntu's wifi connection to the BBB via the usb network connection:

1. SSH to the BBB:

ssh debian@

2. In the BBB console type the following:

sudo ifconfig usb0
sudo route add default gw

3. In the linux console of host system (Ubuntu) type:

sudo su
#wlan0 is my internet facing interface, eth1 is the BeagleBone USB connection
ifconfig eth1
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward

4. Set the DNS server address in the BBB console:

echo "nameserver" >> /etc/resolv.conf