On my Galaxy Note 2 phone (Android of course), is it possible to edit the hosts file so that it resolves 'example.com' to a public IP BUT resolves it to a local private IP if connected to wifi with a specific SSID? i.e. connected at home to the wifi, it resolves a domain name to a local server on the LAN, but anyplace else it resolves it to the public IP?

I'm guessing it'd be hard at the very least, if it's even possible, but do I have any options here (either hosts, or some other way)? I've got shell access, and root access, so I can edit pretty much anything that needs to be.

migrated from superuser.com Nov 27 '13 at 20:49

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

  • 1
    Are you able to run a DNS server at home with "example.com" coded "specially", and then to feed your phone those DNS servers via DHCP when on your home WIFI ? – davidgo Nov 26 '13 at 4:43
  • I can put bind9 on my linux box, but I'm not sure how to set it up to resolve from that and not the ISP's servers via the router – user184214 Nov 26 '13 at 4:53
  • Run bind as a forwarder /recursive server along with your zone of interest. In the DHCP device (on your router), specify the IP address of your Linux box rather then your ISP's dns server. – davidgo Nov 26 '13 at 5:16
  • I'll dig up how to do that, and see if I can get it working, thanks! – user184214 Nov 26 '13 at 9:38

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.