# Internet sharing Internet sharing between a PC and the BeagleBone boards can be done on any OS. Thus, the next sections will indicate the different instructions for enabling internet sharing. # Windows PC The following guide is based on [^1]. In the `cmd` application, run the next command to determine the connection *IP* between your PC and the BBB: ``` ping 192.168.7.2 Pinging 192.168.7.2 with 32 bytes of data: Reply from 192.168.7.2: bytes=32 time=1ms TTL=64 Reply from 192.168.7.2: bytes=32 time=2ms TTL=64 Reply from 192.168.7.2: bytes=32 time=1ms TTL=64 Reply from 192.168.7.2: bytes=32 time=2ms TTL=64 Ping statistics for 192.168.7.2: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 1ms, Maximum = 2ms, Average = 1ms ``` if you get 0% loss, then the BBB has a network connection between PC and BBB: BBB <----> Windows PC 192.168.7.2 192.168.7.1 Next, open the **network connection** application to identify the internet connection adapter and the BBB-USB connection: ![Network Connection](./nc.png) In my case, the `Ethernet` connection is the one with the Internet, while the `Ethernet 3` is the BeagleBone; notice that the BB indicates a **USB Host Device**. ![Networks](./connections.png) Then, the network with an internet connection must be shared with the BBB. Therefore, make right-click on the *Ethernet connection* with the internet and select options: ![options](./properties.png) then click on the `Sharing` tab and enable the `Internet Connection Sharing` as shown below. Now, you have to select one network connection to share the internet; remember that, in my case, it is `Ethernet 3` (USB-BBB Device). ![share option](./share.png) After that, we should open the USB-Device network connection properties by right-clicking on its icon: ![](./tcp.png) then select the `Internet Protocol Version 4(TCP/IPv4)` and click on the properties button; at this point, you will probably lose the connection between the BBB and Windows. Also, the OS will make some undesirable changes in the assigned IP to the PC; it is wrong (it must be 192.168.7.1) ![](./wrong-ip.png) next, we have to solve this error assignment by clicking on the `Obtain an IP address automatically` option or writing the correct IP by yourself ![](./ipok.png) Finally, we have to indicate to the BBB the IP used for any outside requests using the next commands in the **BBB's Shell**: ``` sudo /sbin/route add default gw 192.168.7.1 ``` and then check with `ping 8.8.8.8` command. ``` echo "nameserver 8.8.8.8" >> /etc/resolv.conf ``` # GNU/Linux In the PocketBeagle, 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 PocketBeagle 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 ``` # References [^1]: https://ofitselfso.com/BeagleNotes/HowToConnectBeagleboneBlackToTheInternetViaUSB.php [^2]: http://jpdelacroix.com/tutorials/sharing-internet-beaglebone-black.html [^3]: https://www.dangtrinh.com/2015/05/sharing-internet-with-beaglebone-black.html [^4]: https://www.elementzonline.com/blog/Sharing-Internet-using-Network-Over-USB-in-PocketBeagle