Push static route to android client

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

It's working great on my pc running linux:

ip route
default via dev wlan0 proto dhcp metric 600 dev wlan0 scope link metric 1000 dev wlan0 proto kernel scope link src metric 600 via 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

I added below route for testing:

pi@ph5a:~ $ sudo nano /etc/dnsmasq.d/99-my-settings.conf

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

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

But my Android phone doesnt in a Termux session:

$ ip route show dev wlan0 proto kernel scope link src dev rmnet1 proto kernel scope link src

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 default and not the DNS servers received via DHCP:

$ nslookup pi-hole.net

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

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
	up ip route add default via dev eth0 metric 200
	up ip route add default via dev usb0 metric 100
	up ip route add via dev eth0

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