Internet Connection on Beaglebone over USB
Sometimes, we meet a condition that forced us to have an internet connection to our Beaglebone Black (BBB), such as updating OS package, upgrading OS package, or even a program installation. BBB has an useful feature to get an internet connection through USB port. The idea is to share/forward our laptop’s internet connection to our BBB through USB cable instead of ethernet cable. Here is the tutorial to get an internet connection to our BBB.
In this case, i use BBB Rev C that using Debian OS. Here is my BBB configuration.
1 2 3 4 5 6 7 8 9 |
login as: root Debian GNU/Linux 7 BeagleBoard.org BeagleBone Debian Image 2014-04-23 Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian Last login: Wed Apr 23 23:53:40 2014 from 192.168.7.1 root@beaglebone:~# uname -a Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09 UTC 2014 armv7l GNU/Linux |
and here is my network configuration on my laptop (Windows 7).
First, share the laptop’s internet connection (Wireless Network Connection) to our BBB (Local Area Connection 3). To do this, open the wireless connection properties and select the sharing tab. Then check the Allow other network to connect through this computer’s Internet connection box, and choose the Local Area Connection 3 from Home networking connection list then click OK. Then click “Yes” to next dialog box below.
In this step your BBB may lose connectivity with the laptop, please back to the BBB’s network properties and set the IP address to automatically.
After we share the Laptop’s internet Connection, you are to setup the default gateway to 192.168.7.1. To do this follow this command:
1 |
root@beaglebone:~# route add default gw 192.168.7.1 |
Next, add 8.8.8.8 as a nameserver to /etc/resolv.conf, you can check the contain of resolv.conf first.
1 2 |
root@beaglebone:~# more /etc/resolv.conf nameserver 192.168.1.1 |
the resolv.conf contain 192.168.1.1 only, so then add the 8.8.8.8 to the resolv.conf and check once more
1 2 3 4 |
root@beaglebone:~# echo "nameserver 8.8.8.8" >> /etc/resolv.conf root@beaglebone:~# more /etc/resolv.conf nameserver 192.168.1.1 nameserver 8.8.8.8 |
Now we can ping to 8.8.8.8 or ping to google.com, use Ctrl+C to stop.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
root@beaglebone:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_req=1 ttl=46 time=1249 ms 64 bytes from 8.8.8.8: icmp_req=2 ttl=46 time=269 ms 64 bytes from 8.8.8.8: icmp_req=3 ttl=46 time=378 ms 64 bytes from 8.8.8.8: icmp_req=4 ttl=46 time=125 ms 64 bytes from 8.8.8.8: icmp_req=5 ttl=46 time=125 ms 64 bytes from 8.8.8.8: icmp_req=6 ttl=46 time=162 ms 64 bytes from 8.8.8.8: icmp_req=7 ttl=46 time=161 ms 64 bytes from 8.8.8.8: icmp_req=8 ttl=46 time=389 ms 64 bytes from 8.8.8.8: icmp_req=9 ttl=46 time=179 ms ^C --- 8.8.8.8 ping statistics --- 9 packets transmitted, 9 received, 0% packet loss, time 8010ms rtt min/avg/max/mdev = 125.766/337.981/1249.457/336.138 ms, pipe 2 |
Here is the google.com ping statistics.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
root@beaglebone:~# ping google.com PING google.com (74.125.135.101) 56(84) bytes of data. 64 bytes from 74.125.135.101: icmp_req=1 ttl=49 time=555 ms 64 bytes from 74.125.135.101: icmp_req=2 ttl=49 time=412 ms 64 bytes from 74.125.135.101: icmp_req=3 ttl=49 time=1279 ms 64 bytes from 74.125.135.101: icmp_req=4 ttl=49 time=1929 ms 64 bytes from 74.125.135.101: icmp_req=5 ttl=49 time=309 ms 64 bytes from 74.125.135.101: icmp_req=6 ttl=49 time=248 ms ^C --- google.com ping statistics --- 6 packets transmitted, 6 received, 0% packet loss, time 167747ms rtt min/avg/max/mdev = 248.884/789.378/1929.678/613.614 ms, pipe 2 |
You can try to ping another website, like sonoku.com. If you can see this similar statistics, now you have internet connection to your BBB.
1 2 3 4 5 6 7 8 9 10 11 |
root@beaglebone:~# ping sonoku.com PING sonoku.com (174.120.70.215) 56(84) bytes of data. 64 bytes from 174.120.70.215: icmp_req=1 ttl=49 time=1590 ms 64 bytes from 174.120.70.215: icmp_req=2 ttl=49 time=816 ms 64 bytes from 174.120.70.215: icmp_req=3 ttl=49 time=535 ms 64 bytes from 174.120.70.215: icmp_req=4 ttl=49 time=909 ms ^C --- sonoku.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 101238ms rtt min/avg/max/mdev = 535.550/962.987/1590.404/387.514 ms, pipe 2 |