give BBB an internet access

Tried many things to make BBB connected to internet. There’re few different ways such as by enabling ethernet port or adding USB Wi-Fi dongle. But it won’t work stable when we move BBB to difference environment. Thus, I think sharing host internet is easiest way to give BBB an internet access. To make this we should route all outbound packets to this device from the BBB to the Internet via the Internet access interface.

First thing first, make USB connection between BBB and host machine.
Then check the IP address on USB port.

USB0 has 192.168.7.1 and it is a default gateway for BBB’s usb0 interface.

Host Setting

#Enabling traffic re-routing to Internet Access interface on host machine
#In this case, Internet traffic fro BBB’s USB0 enx4c3fd3c18fa6 will be routed to host’s Wi-Fi interface wlp10
$sudo sysctl net.ipv4.ip_forward=1
$sudo iptables --table nat --append POSTROUTING --out-interface wlp1s0 -j MASQUERADE
$sudo iptables --append FORWARD --in-interface enx4c3fd3c18fa6 -j ACCEPT

BBB Setting

#as a root
[email protected]:/#route add default gw 192.168.7.1
[email protected]:/#echo "nameserver 8.8.8.8" >> /etc/resolv.conf

Leave a Reply

Your email address will not be published. Required fields are marked *