1

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?

6
  • I expect that the issue you are running into is that the mobile data is not going through the NAT chain.
    – davidgo
    Commented Mar 21, 2018 at 20:33
  • @davidgo Yes. Why is it happening?
    – Finch
    Commented Mar 23, 2018 at 11:02
  • Very often, NAT is applied on the outbound interface. The tunnel creates a new outbound interface which may not be matched against the IPTables.rule to do NAT.
    – davidgo
    Commented Mar 23, 2018 at 13:11
  • 1
    Possible duplicate of How to change mobile connections's DNS on Android KitKat? Commented Mar 25, 2018 at 10:54
  • I don't think this is quite a duplicate, as the method that's described as not working here is one of the answers on the linked question.
    – Dan Hulme
    Commented Mar 25, 2018 at 17:32

0

You must log in to answer this question.

Browse other questions tagged .