Sharing the Host Computer's Internet Connection
When connected to your BBB via a USB cable, it is possible to share the host computer's connection. You probably won't need to connect it to the Internet often, but it does make installing software much easier. Before you follow the steps below, make sure your Beaglebone is not already connected to a network by cable or Wifi (just unplug the Ethernet cable or Wifi dongle from your BBB if you have been using either).
- Click Start and type network >> Network & Sharing Center >> Change Adapter Settings
- Right click the connection that provides your computer with Internet access and select Properties
- Click the Sharing tab and check the Allow other network users to connect through this computer's Internet connection box.
- From the Home networking connection dropdown menu, choose the connection associated with your Beaglebone.
- Click OK
- Right click your BBB's connection and select Properties.
- Click on Internet Protocol Version 4 (TCP/IPv4) and select properties
- Click the radio buttons to obtain an IP and DNS server address automatically.
- Click OK
You may have to go through this process again if you unplug your BBB and try to reconnect. If you run into difficulties, uncheck the Allow other network users to connect... box, and click okay. This should reset your connections to the Internet and your BBB. Then, go through the entire process again. Derek Molloy's Youtube tutorial describes this process in great detail, but his approach is a bit cumbersome.
Newer Macs (Tested on OSX 10.7.5 & 10.9.2):
Log into an Administrator account and use Terminal to run the following commands (these steps do NOT work for Mavericks-10.9.2 on the TBCS network. They work fine when the host Mac is tethered to my phone).
- sudo su
- ifconfig en3 192.168.7.1 (where en3 is the BBB's interface)
- sysctl -w net.inet.ip.fw.enable=1
- sysctl -w net.inet.ip.forwarding=1
- natd -interface en1 (where en1 is the interface for the Mac's Internet connection)
- ipfw add divert natd ip from any to any via en1
When connected to an older Linksys, that was all I had to do. However, when using newer Netgear routers, I had to log into the routers and change the NAT Filtering
from Secured to Open and perform the steps listed for older Macs.
Older Macs (Tested on OSX 10.6.8)
(This method allows me to ping www.google.com and set the date/time when connected to the TBCS network-need to test elsewhere)
- System Preferences >> Sharing >> click on Internet Sharing >> check BeagleBoneBlack >> check Internet Sharing
- You may need to reset your BeagleBone at this point.
From now on you only need run the script each time you restart your BBB
- Create a script using nano (a command line text editor) by typing nano ShareInternet and add the following lines
- set -x
- /sbin/route add default gw 192.168.7.1
- echo "nameserver 22.214.171.124" >> /etc/resolv.conf
- ntpdate -b -s -u us.pool.ntp.org
- Make the script executable by typing chmod +x ShareInternet
- Run the script by typing ./ShareInternet