Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default gateway not working on usb0 #85

Open
b-trav opened this issue May 7, 2018 · 2 comments
Open

default gateway not working on usb0 #85

b-trav opened this issue May 7, 2018 · 2 comments

Comments

@b-trav
Copy link

b-trav commented May 7, 2018

Hi Robert,

Thanks for your work.

I am playing around with the PocketBeagle. I am ssh'ing over usb0, and at the moment I have to type:

sudo ip route add default via 192.168.7.1
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

in order to get internet access on the PocketBeagle.
This is despite my /etc/network/interfaces file containing:

iface usb0 inet static
    address 192.168.7.2
    netmask 255.255.255.0
    gateway 192.168.7.1
    dns-nameservers 8.8.8.8

I can get around the resolv.conf issue by disabling connman:

sudo systemctl disable connman.service

but cannot figure out how to set the default gateway. I am guessing the problem is with autoconfigure_usb0.sh?

Any suggestions would be greatly appreciated.

Thanks,

Ben

@timburgess
Copy link

The /etc/network/interfaces file is parsed by the autoconfigure_usb0.sh script in /opt/scripts/boot

Looking at that script, although it looks for the gateway value, it doesn't seem to do actually do much with it.
Using the current Debian stretch image, doing a ip route show after boot reports:

192.168.6.0/30 dev usb1 proto kernel scope link src 192.168.6.2 
192.168.7.0/30 dev usb0 proto kernel scope link src 192.168.7.2

If I add a route add default gw 192.168.7.1 as the last command in the final if statement in autoconfigure_usb0.sh, then after boot, I get:

default via 192.168.7.1 dev usb0
192.168.6.0/30 dev usb1 proto kernel scope link src 192.168.6.2 
192.168.7.0/30 dev usb0 proto kernel scope link src 192.168.7.2

and a working network route via my laptop.

For the record, on my linux laptop I'm forwarding from usb to wifi with:

sudo sysctl net.ipv4.ip_forward=1
sudo iptables --table nat --append POSTROUTING --out-interface wlp4s0 -j MASQUERADE
sudo iptables --append FORWARD --in-interface enx985dad314e0d -j ACCEPT

@RobertCNelson
Copy link
Owner

Sadly it's not well documented, but there are some helper scripts here:

https://github.com/RobertCNelson/boot-scripts/tree/master/network

(/opt/scripts/network/)

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants