Push static route to android client

Hi
I added a static route to pihole dhcp server like explained here: Pihole DHCP: push a static route to clients - #2 by deHakkelaar

cat /etc/dnsmasq.d/99-my-settings.conf
dhcp-option=option:classless-static-route,0.0.0.0/0,192.168.0.2,192.168.1.0/24,192.168.0.11

It's working great on my pc running linux:

ip route
default via 192.168.0.2 dev wlan0 proto dhcp metric 600 
169.254.0.0/16 dev wlan0 scope link metric 1000 
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.235 metric 600 
192.168.1.0/24 via 192.168.0.11 dev wlan0 proto dhcp metric 600

however my android tablet does not get it. It's running android Oreo, not rooted.
Any idea on how to solve this issue?

Many thanks
Christian

I added below route for testing:

pi@ph5a:~ $ sudo nano /etc/dnsmasq.d/99-my-settings.conf
dhcp-option=option:classless-static-route,0.0.0.0/0,10.0.0.1,192.168.1.0/24,10.0.0.99

And after renewing client DHCP leases, my Windows and Linux clients have the added route configured:

C:\>route PRINT
[..]
      192.168.1.0    255.255.255.0        10.0.0.99        10.0.0.11     11
[..]
dehakkelaar@laptop:~$ ip route show
[..]
192.168.1.0/24 via 10.0.0.99 dev wlan0 proto dhcp metric 600

But my Android phone doesnt in a Termux session:

$ ip route show
10.0.0.0/24 dev wlan0 proto kernel scope link src 10.0.0.143
10.83.242.0/24 dev rmnet1 proto kernel scope link src 10.83.242.254

But I dont trust Termux because I believe it runs in an environment different from what the apps are running in.
For example the nslookup tool always queries 8.8.8.8 default and not the DNS servers received via DHCP:

$ nslookup pi-hole.net
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   pi-hole.net
Address: 178.128.134.214

So I dont know of a reliable way to show the routes under Android other than actually testing/using the route.

Looking around, it seems Android has issues with static routes, so I gave up on this approach and instead set a routing rule on the system running pi-hole, which also acts as a gateway. I don't know why I didn't think of that before...

iface eth0 inet static
	address 192.168.0.2
	netmask 255.255.255.0
	network 192.168.0.0
	broadcast 192.168.0.255
	up ip route add default via 192.168.0.1 dev eth0 metric 200
	up ip route add default via 192.168.42.129 dev usb0 metric 100
	up ip route add 192.168.1.0/24 via 192.168.0.11 dev eth0

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.