I am using IP tables to force the system to used a specific DNS but it only seems to work for WiFi networks but not mobile data.
These are the IP tables I use:
iptables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to-destination 8.8.8.8:53
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 8.8.8.8:53
These commands are set to run on startup.
Apparently this is not affecting dns lookups when using mobile data?
Where are the DNS settings stored in Android? Where does the system obtain DNS when using mobile data?
iptables
should work with WiFi and Mobile Data both. None of the IP traffic can escapenetfilter
. Also there are other ways to force DNS globally. See details here: How to configure DNS properly? – Irfan Latif Dec 26 '19 at 16:29