Connecting a BeagleBone Black (BBB) to the internet over USB is a simple process thanks to the internet sharing capabilities of Windows. This is extremely convenient when developing because it allows your BeagleBone Black to have an internet connection as long as your computer or laptop has one, no matter the network, and SSH access over a single USB cable.
Windows Configuration
These instructions assume you have already installed an image on your BBB and can connect to the web interface. If not, the official documentation is extremely thorough and easy to follow.
Step 1: Configure your primary network interface for sharing.
Open the Run prompt (Win+R)
and enter ncpa.cpl
to open Network Connections.
You should see (in addition to your regular network connection) a new connection with a description that starts with “Linux USB Ethernet” or something similar. This is your BBB’s connection.
Right click on the internet connection your want to share (not on the BBB connection) and click on Properties. In the properties window click on the Sharing tab and check the box that says Allow other network users to connect through this computer’s Internet connection. Select the BBB’s connection under the Home networking connection: dropdown then click OK to save.
Double click on the BBB’s connection and click on Internet Protocol Version 4 (TCP/IPv4) to highlight it then click on Properties. Alternatively you can just double click on the text (not the checkbox).
Fill in the IP address and DNS information as shown in the image. The BBB will expect the computer to have an IP address of 192.168.7.1
and it will use the computer as a gateway to the internet.
That’s all the setup needed on the Windows machine!
Step 2: BeagleBone Black Configuration
All of the configuration needed on the BBB is in a single file. Interestingly, all the tutorials I’ve seen on this topic don’t show the proper way of configuring the network so that the changes are persistent.
SSH Access
The first step is to connect to the BBB via SSH. PuTTY is the de facto SSH client on Windows and I highly recommend it. Open up PuTTy and enter the BBB’s default IP address (192.169.7.2
) then press Open. You may see a warning sign pop up if it’s the first time connecting to the IP but just click Yes and continue.
You’ll be asked for a login. The default credentials are:
login: debian pass: temppwd
Be sure to change the password!
Note: When typing in the password, you will not see anything happening. That’s a security feature — just press enter when you enter the full password.
Configuration
We will be editing the interfaces file, which is used to configure the network interfaces on the system as the name suggests. Enter the following command to open up the file for editing:
sudo nano /etc/network/interfaces
sudo
( originally called “superuser do”) temporarily elevates the security privileges of the debian user to the superuser so that it can modify system files. You will be asked to enter the user password which is temppwd in the default case. nano
is a simple text editor that’s present on most Linux systems.
Once in the file, use the down arrow key or Page Down key to go to the bottom of the file where you should see entries for the usb0 interface. Enter the following information:
iface usb0 inet static address 192.168.7.2 netmask 255.255.255.252 network 192.168.7.0 gateway 192.168.7.1 dns-nameservers 8.8.8.8 post-up route add default gw 192.168.7.1
When the system starts up, the system runs a configuration script located at /opt/scripts/boot/autoconfigure_usb0.sh
that reads this /etc/network/interfaces
file and sets the IP address and netmask for the usb0 interface.
The configuration script also reads the dns-nameservers value and writes it to /etc/resolv.conf. Lastly, the script executes the post-up value line after the network interface is up (thus the name) in order to add the default gateway (which is the IP address we set on the Windows machine) to the route.
After making the changes, press CTRL+O
to save the changes then CTRL+X
to close the file. Reboot the system with:
sudo reboot
After the reboot is complete, connect to the system again (you can just right-click anywhere on the PuTTy window and click on Restart session).
The route command will show you if the gateway is set.
route
The /etc/resolv.conf file should also contain the nameserver entry.
cat /etc/resolv.conf
That’s all the configuration needed to get internet over USB working! You can test it out by pinging Google with ping google.com
. You can press CTRL+C
to stop the ping command.
Is it possible to access PPP0 and Eth0 at a time in beagleboneblack.
if it is possible how to do?. could you please help to me.
Yes you can but you’ll need to make sure your routes are configured properly. If you have multiple interfaces the BeagleBone needs to know the default route, etc., for your traffic.
Hi, I followed your tutorial and ran into a problem. I can’t ssh back in after I shared my network connection with the beaglebone black. I’m using Ubuntu and Windows 10 Education. Is there a fix to this issue?
Make sure that the Windows IP address settings are correct. When you share your connection Windows resets the IP settings to some default values for the interface.
I have the same issue as Arthur. What do you mean the Window IP address? How can I check it and what should I see? I fill the form as it is written here.
Thanks a lot, i was stuck at this step and your post really helped.
To add to this, oftentimes the Antivirus blocks the driver. It is advisable to pause the antivirus while the device has to be used with USB interface.