How to set custom DNS server for Chrome browser?
I have a local DNS server that resolves all URLs *.domain.tld
to 127.0.0.1
.
Also, I have the production server with the same address *.domain.tld
.
They have the same names, because subdomains interact with each other, and I have hardcoded domain URLs. I can't change them in the production server.
The problem is to reach the production server from my developer computer without touching the DNS server and /etc/hosts
.
I found some options for Chrome such as --dns-server
, --host-rules
, but none is working.
I have Google Chrome 23.0.1271.64 and Chromium 22.0.1229.94 on Ubuntu 12.10 64-bit.
Chromium's DNS resolver is broken, and it won't respect the order in resolv.conf. So when I try to connect to hosts on my VPN, which the system resolves correctly using the VPN's DNS server, Chromium instead uses the non-VPN DNS, and resolves it to my internet provider's advertisement page (which they gratuitously reply with to any non-resolving host).
The only solution I've found was to add private IPs to /etc/hosts.
You could use an extension to redirect a named HTTP request to one using an IP address.
This solution doesn't require any modification of the DNS or hosts file, and this redirection may possibly be enabled on and off via the extension :
Switcheroo Redirector
FoxyProxy Chrome extension worked nicely for me. It is also available for Mozilla Firefox as well. However, can take some time to configure initially. Have tested only for locally hosted sites without HTTPS.
Host Switch Plus extension for Chrome worked for me. Though easier to configure, as it allows multiple tagged entries for different environments as well. However, it seems to have some error which causes it to fail sometimes.