BBB: sharing Internet connection from Linux laptop with USB

Yesterday, I got Internet connection sharing over USB working on my system.

My BeagleBone Black is connected via USB to my Linux laptop (Ubuntu
17.10). The BBB is able to connect to the Internet by my Laptop
laptop forwarding traffic through the WiFi interface.

BBB <-- USB --> Laptop <-- WiFi --> Internet

I got this working 6 months ago but had a really hard time recreating
those steps yesterday. I've noted what I did in this GitHub Gist in
case it helps anyone else (and myself in the future :slight_smile:

https://gist.github.com/pdp7/d2711b5ff1fbb000240bd8337b859412

Also, if you are having issues yourself, then please reply here and I
can try to make suggestions.

Thanks,
Drew

internet-sharing-usb-linux_md.txt (7.83 KB)

@Drew, you should check out the fancy "helpers" under:

/opt/scripts/network/

(they are relatively new (about a month))

Regards,

Thanks! I'll check it out!

debian@beaglebone:/opt/scripts$ git pull
<snip>
11 files changed, 180 insertions(+), 61 deletions(-)
create mode 100644 network/doc-debian-setup.md
create mode 100755 network/usb_linux_usb0_ics.sh
create mode 100755 network/usb_linux_usb1_ics.sh
create mode 100755 network/usb_mac_ics.sh
create mode 100755 network/usb_windows_ics.sh

Thanks! I'll check it out!

debian@beaglebone:/opt/scripts$ git pull
<snip>
11 files changed, 180 insertions(+), 61 deletions(-)
create mode 100644 network/doc-debian-setup.md
create mode 100755 network/usb_linux_usb0_ics.sh
create mode 100755 network/usb_linux_usb1_ics.sh
create mode 100755 network/usb_mac_ics.sh
create mode 100755 network/usb_windows_ics.sh

Shall we put any scripts meant for hosts into getting-started-guide?

Why go through all of that when you can just enable Internet connection sharing via NetworkManager?

I agree with using nm-connection-editor on Ubuntu. A confusing point to me was using the setting “Shared to other computers” on the downstream port on the host and setting nothing special on the upstream port. In hindsight, it makes sense, but the instructions didn’t make that clear at all. My thinking when reading the phrase was “this is the upstream connection I want to share to other computers”, but a better interpretation is “this is the downstream port where I want expose my upstream to other computers“.

Hi Drew,

Thanks for making documentation for this stuff.
I’ve tried step by step of your tutorial but my BBB still cannot connect to the internet.
One step i cannot accomplish is this part :

root@sp3:~# sysctl -a |fgrep .forwarding |grep ^net |grep ipv4
net.ipv4.conf.all.forwarding = 1
net.ipv4.conf.default.forwarding = 1
net.ipv4.conf.enx1cba8c9bbeb5.forwarding = 1
net.ipv4.conf.enx1cba8c9bbeb8.forwarding = 1
net.ipv4.conf.lo.forwarding = 1
net.ipv4.conf.wlxe0b94db737c9.forwarding = 1


Where can i find the file to set all those parameters value to “1” ?

I am using Ubuntu 16.04, Mobile WiFi, and beaglebone black Rev C.

I have them in this file on my Ubuntu laptop:
/etc/sysctl.d/99-sysctl.conf

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
net.ipv6.conf.all.forwarding=1

-drew

Hi Drew,
Thank you so much for posting this. Although I have a problem. After following all the steps, I was able to ping 8.8.8.8 , but when I typed "car /etc/resolv.conf " I get a warning - # DO NOT EDIT THIS FILE BY HAND – YOUR CHANGES WILL BE OVERWRITTEN

  1. And after that “nameserver 127.0.0.1” which is a loopback for the host, I was expecting to see “nameserver 8.8.8.8” instead.

How ever I tried this → echo “nameserver 8.8.8.8” >> /etc/resolv.conf

And this helped to" ping google.com " successfully.
3. But when I restart the beaglebone all the configuration is supposedly lost. And network on beaglebone becomes unreachable again

Am I missing something ?
Any help is appreciated. Also other guys have discussed about using a network manager GUI on ubuntu.Any article or steps if thats easier ?

Thank you
Raj

Jason,

I sent you a message a few weeks ago was wondering if you received my e-mail regarding web pages?

Ken

Hi Drew, after uncommenting those lines and running ‘sysctl -a |fgrep .forwarding |grep ^net |grep ipv4’ those configurations are still disabled. Is there a step I’m missing after uncommenting those lines?

Hi Drew, after uncommenting those lines and running 'sysctl -a |fgrep
.forwarding |grep ^net |grep ipv4' those configurations are still disabled.
Is there a step I'm missing after uncommenting those lines?

Did you reboot?

that file is automatically (re)generated if you are using dhcp
to autoconfigure the network; if you use a static configuration you're on
your own. as a manual quick fix simply create it (as root):

echo "nameserver 1.0.0.1" > /etc/resolv.conf

at that point you should have working dns, ie.
host one.one.one.one
should spit out something sensible.