Sharing internet using Network-Over-USB in BeagleBone Black

BeagleBone is a credit card sized computer used as an embedded development hardware known for its reasonable pricing and flexibility in use. Use of Capes make the BBB more acceptable among hobbyist.

BeagleBone_Black

BBB comes with a USB connectivity named USB-Ethernet, by default has 192.168.7.2 as the ip address, which can be used to do Arduino like programming using Cloud9 IDE.

This post is intended to help users to make use of USB networking of BBB 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.

Debian distribution

Debian distribution

The Debian OS is used for the testing which is obtained from here.

BBB console can be got by using the following command

ssh 192.168.7.2 -l root

In the BBB 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 BeagleBone 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 BBB….

 

20 thoughts on “Sharing internet using Network-Over-USB in BeagleBone Black

  1. Pingback: Sharing internet using Network-Over-USB in BeagleBone Black #BeagleBoneBlack @TXInstruments @BeagleBoardOrg « adafruit industries blog

  2. may someone help me ? I connected my BBB using sharing internet over usb, but when I connect my ethernet cable on beaglebone the connection with internet is lost, I’m using the Ethernet cable to access another device. Please can someone help me ? Sorry for my bad english.

    • Hello Renatho Oliveira,

      Try disabling DHCP Client or edit /etc/network/interfaces to have eth0 using a Static IP.

      May be you have to supply external 5V power also to the board through the DC Jack, which is capable of providing 1Amps or more.

  3. Thanks! this saved me a ton of time, but Ubuntu 15.10 wasted more than this made up. Who the H**L thinks this this is progress:
    netstat -i
    wlp3s3 …. blah blah
    enp2s0 … blah blah

    as opposed to a sane system:
    netstat -i
    wlan0
    eth0

    Are the developers taking money under the table to drive people back to using Windows in frustration??
    Substituting these ridiculous names for the once in this blog got it working. Hope this helps someone else.

  4. Hey! Thanks for this tutorial, it worked for me without any problems. I connected my BBB to the USB port of my computer, typed in your commands and *TADDA* I had internet connection over USB 🙂

  5. Hi, I am having problems connecting to the BBB from both my OSX and Ubuntu laptops. I am hoping to do what you recommend but need to sort out the connection first, which occasionally has worked but usually doesn’t – it hangs. I have tried a range of things including deleting entries in ‘known_hosts’ and editing the ssh_config file but have not had any success yet despite extensive forum searches. Can you help at all with this? Any help greatly appreciated.

  6. Pingback: Wlan / Wifi Beaglebone Black TP-Link TL-WN722N | smidgeon pigeon

  7. For the linux console of the host, you mention:

    # wlan0 is my internet facing interface, eth5 is the BeagleBone USB connection

    How do I find out what the values are on my machine for wlan0 and eth5?

    I am using Ubuntu 14.04 (VirtualBox hosted on Windows7).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s