Does Chrome use a different DNS server from the OS?

11

1

I'm running Chrome on Linux. I have local DNS to resolve *.myname.com into 127.0.0.2 (I type "host whatever.myname.com" or "host myname.com" and I see the correct address). However in Chrome when I type "myname.com" it is redirected to "www.myname.com" and solve the "real" website that I don't want.

Only when I type "test.myname.com", not "www.myname.com", Chrome correctly resolves it into 127.0.0.2. I guess Chrome is trying to do funky thing with www.anything.com and anything.com.

How to fix it?

PS: the local DNS I'm using is dnsmasq. If I explicitely put myname.com into /etc/hosts Chrome resolves it correctly into 127.0.0.2, but I can't use wildcard in /etc/hosts.

PPS: I can confirm at chrome://net-internals/#dns that Chrome correctly myname.com and www.myname.com into the real public IP.

jcisio

Posted 2013-10-10T10:04:11.577

Reputation: 317

Answers

6

In fact Chrome was using it own DNS client that talks with multiple DNS servers (the local DNS, the router DNS, the router DNS in IPv6). I go to chrome://flags and disable "Built-in Asynchronous DNS". Now it works.

jcisio

Posted 2013-10-10T10:04:11.577

Reputation: 317

2

The "Built-in Asynchronous DNS" flag was removed from Google Chrome, thereby disabling the "fix" for this. https://chromium.googlesource.com/chromium/src/+/eabf1f5baba38d46921acd6edda594f942f7d6a1

(from http://superuser.com/a/887191/109126)

– jcisio – 2015-03-09T11:54:30.347

5This option was removed from Chrome, remove the answer to prevent confusion, or downvotes :D – sorin – 2015-04-24T09:15:04.340

1There's still some kind of issue here. I'm using Chrome 56 on Linux Mint, and it takes several minutes to resolve addresses after connecting to a VPN. Firefox does it immediately. It's seems that Chrome takes awhile to see changes in /etc/resolv.conf. – orodbhen – 2017-02-22T12:21:09.627

1It's still valid in Chrome for Android. The option is called "Async DNS resolver" (chrome://flags/#enable-async-dns) – MaxChinni – 2018-04-04T10:18:23.050

1there is no such option in 69+ and disabling chrome://flags/#enable-new-preconnect (mentions DNS) doesn't help – vladkras – 2018-09-20T15:44:23.080

1

You can change your proxy settings and force it to use the address you want.

Open a new file, with .pac extention, those files are used by the system to determine proxies, copy this to the content of the file:

function FindProxyForURL(url, host) {
    if (host=='www.myname.com' || host=='myname.com'){
        return 'PROXY 127.0.0.2';
    }
    // All other domains should connect directly without a proxy
    return "DIRECT";
}

go to chrome proxy settings, and under "url for automatic proxy configuration" enter the path to that file.

no need to have DNS server, you can redirect it to different ports on the machine, and you can program it for your needs.

Ohad Cohen

Posted 2013-10-10T10:04:11.577

Reputation: 239

1I used it when I used Mac, because in OS X I can use the .pac file for the whole system. Not in Linux AFAIK (it does not work with wget, curl etc.). – jcisio – 2013-10-10T10:50:01.620

what linux do you have? (i have kubuntu and it's working) – Ohad Cohen – 2013-10-10T10:54:26.677

Archlinux + KDE. I just don't believe Chrome settings can change OS behavior in the console. – jcisio – 2013-10-10T13:23:39.550

chrome proxy settings just open system proxy settings – Ohad Cohen – 2013-10-10T15:00:08.873

Thanks, I've just tested with xubuntu in my netbook. It couldnot open the systme proxy settings (the page chrome://linux-proxy-config/ gave an error). I'll try with my Archlinux later. – jcisio – 2013-10-10T18:35:09.320

change system proxy settings and see if it affects chrome – Ohad Cohen – 2013-10-11T09:32:19.660

I've just tested with Kubuntu and indeed it works. It does not solve the global problem (with Xubuntu, Archlinux + custom KDE etc.) but thank you BTW. Now I know that in some desktop environment, there is system wide proxy settings like OS X ;) – jcisio – 2013-10-14T09:28:12.777