The repository shows the different methods for internet sharing over the USB between the PC and Beagle Bone Board.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.5 KiB

  1. # Internet sharing
  2. 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.
  3. # Windows PC
  4. 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:
  5. ```
  6. ping 192.168.7.2
  7. Pinging 192.168.7.2 with 32 bytes of data:
  8. Reply from 192.168.7.2: bytes=32 time=1ms TTL=64
  9. Reply from 192.168.7.2: bytes=32 time=2ms TTL=64
  10. Reply from 192.168.7.2: bytes=32 time=1ms TTL=64
  11. Reply from 192.168.7.2: bytes=32 time=2ms TTL=64
  12. Ping statistics for 192.168.7.2:
  13. Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
  14. Approximate round trip times in milli-seconds:
  15. Minimum = 1ms, Maximum = 2ms, Average = 1ms
  16. ```
  17. if you get 0% loss, then the BBB has a network connection between PC and BBB:
  18. BBB <----> Windows PC
  19. 192.168.7.2 192.168.7.1
  20. Next, open the **network connection** application to identify the internet connection adapter and the BBB-USB connection:
  21. ![Network Connection](./nc.png)
  22. 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**.
  23. ![Networks](./connections.png)
  24. 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:
  25. ![options](./properties.png)
  26. 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).
  27. ![share option](./share.png)
  28. After that, we should open the USB-Device network connection properties by right-clicking on its icon:
  29. ![](./tcp.png)
  30. 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)
  31. ![](./wrong-ip.png)
  32. 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
  33. ![](./ipok.png)
  34. Finally, we have to indicate to the BBB the IP used for any outside requests using the next commands in the **BBB's Shell**:
  35. ```
  36. sudo /sbin/route add default gw 192.168.7.1
  37. ```
  38. and then check with `ping 8.8.8.8` command.
  39. ```
  40. echo "nameserver 8.8.8.8" >> /etc/resolv.conf
  41. ```
  42. # GNU/Linux
  43. In the PocketBeagle, console type the following
  44. ```
  45. ifconfig usb0 192.168.7.2
  46. route add default gw 192.168.7.1
  47. ```
  48. In the linux console of host system type
  49. ```
  50. $ sudo su
  51. #wlan0 is my internet facing interface, eth5 is the PocketBeagle USB connection
  52. $ ifconfig eth5 192.168.7.1
  53. $ iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
  54. $ iptables --append FORWARD --in-interface eth5 -j ACCEPT
  55. $ echo 1 > /proc/sys/net/ipv4/ip_forward
  56. ```
  57. Incase network not accessible then type the following in BBB terminal
  58. ```
  59. echo "nameserver 8.8.8.8" >> /etc/resolv.conf
  60. ```
  61. # References
  62. [^1]: https://ofitselfso.com/BeagleNotes/HowToConnectBeagleboneBlackToTheInternetViaUSB.php
  63. [^2]: http://jpdelacroix.com/tutorials/sharing-internet-beaglebone-black.html
  64. [^3]: https://www.dangtrinh.com/2015/05/sharing-internet-with-beaglebone-black.html
  65. [^4]: https://www.elementzonline.com/blog/Sharing-Internet-using-Network-Over-USB-in-PocketBeagle