0

I have a Beaglebone Black device that uses Debian 9.9 Linux (without UI, I am using terminal for this). (latest image for Beaglebone Black https://beagleboard.org/latest-images)

I enabled and successfully connected to the wifi using conmannctl. (https://fis.gatech.edu/how-to-configure-bbw-wifi/)

When I got connected to the wifi, I am unable to ping externally (8.8.8.8 or www.google.com).

I need to manually add the route via: ip route add default via 192.168.1.1 dev wlan0 and it will be able to connect externally. My IP range at home is 192.168.1.x

I would like to experiment and use this on a place with different WLAN IP range for example 192.168.10.x, with that, I need to run ip route add default via 192.168.10.1 dev wlan0

I am looking for a way to be able to connect to another place with different WLAN IP range without the need of typing and adding the ip route.

I had been researching this since yesterday but it seems I cannot provide the interface only to ip route add command, and the IP always needs to be provided. (or maybe I am not hitting the right google keywords.)

Is there a way to have the route automatically configured whenever I connect to the the interface (wireless lan)? I also tried, connecting a USB to LAN, and I also need to manually issue an ip route command to be able to connect externally.

Currently, I am thinking of creating a python script to do regex parsing on the ifconfig output, and get the first three numbers of the IP on wlan0 (e.g. 192.168.10), and then add .1, then I will use this to execute an ip route add command inside python.

Although, I am thinking if there is a built-in Linux process for this, since when I connect to Wifi on my Ubuntu machine (using the UI), I can immediately browse the internet once the wifi is connected.

0

The usual way to solve that is to run a DHCP server on every LAN segment and a DHCP client on every machine that connects to this LAN segment.

The DHCP protocol allows you to distribute routing information like the default gateway and also other information like DNS servers to use.

As it works on your Ubuntu machine, there is probably a DHCP server running on the WLAN segment (very likely on the AP).

So try running a DHCP client on your Beaglebone (whatever the Beaglebone distribution uses, dhclient is often used in distros), and see if you get something.

Then configure your Beaglebone to do this automatically on connect (there are several ways to do this, depending on what else runs on your Beaglebone distro).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.