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?

migrated from superuser.com Mar 21 '18 at 17:30

This question came from our site for computer enthusiasts and power users.

  • I expect that the issue you are running into is that the mobile data is not going through the NAT chain. – davidgo Mar 21 '18 at 20:33
  • @davidgo Yes. Why is it happening? – Finch Mar 23 '18 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 Mar 23 '18 at 13:11
  • 1
    Possible duplicate of How to change mobile connections's DNS on Android KitKat? – xavier_fakerat Mar 25 '18 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 Mar 25 '18 at 17:32

Your Answer

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

Browse other questions tagged or ask your own question.