Android Modify DNS record (hosts) without root: reliable way

Sometimes we need to modify/add DNS record on Android phone. We can do it on router/PC reliably, but on Android, there is no general reliable way to do that.

Brief Steps

  1. Turn off "Private DNS" in your network settings.
  2. Run a modification app or VPN app, as mentioned below.
  3. Test in your browser or other tool, and enjoy.

Details: Step 2 HOWTO

Naive way

HostsGo app can help you modify DNS record, but it's sometimes not working, kind of unreliable. I eventually got annoyed & gave up.

Router way

If your phone is already connected to your own router... Search for "How to add / spoof DNS record on router". It's much much easier.

HTTP Proxy way

If you are here for washconnect-hack... This way WILL NOT work for you.

Reliable way

v2ray is a flexible proxy tool widely used by millions of Chinese users, to bypass the GFW. It's very reliable given the huge amount user base. It allows you to modify DNS record.

You just need to add your DNS record into the config file. This is an example:

{
  "dns": {
    "hosts": {
      "domain:google.com": "fake-google-com.my_domain.xyz",
      "domain:getwashconnect.com": "fake-wash.my_domain.xyz",
      "domain:us-central1-washmobilepay.cloudfunctions.net": "12.34.56.78",
      "domain:o424104.ingest.sentry.io": "192.168.1.188"
    },
...

Ref: https://www.v2ray.com/en/configuration/dns.html

  • If your v2ray client doesn't allow DNS customization...

Add such configuration on your v2ray server! Then use your v2ray server like a normal server. You can create v2ray server with a one-click script (Example) and learn how to use it. Any v2ray client (such as v2rayNG) would work!

  • Warning

This is super reliable because of large userbase, but, looks like it's appending A record to existing DNS response. It's working perfectly fine for washconnect-hack, but just heads up, if your HTTP server doesn't respond, traffic might fallback to default not-spoofed real server.