How do I add custom DNS server and preserving default DNS of ISP in OS X Mountain Lion

0

I'm using OS X Mountain Lion. I'm using dnsmasq to set up wildcard localhost domain names, such as http://local.dev, to point to localhost. But I have to add 127.0.0.1 in my system preference -> network settings.

After I set up 127.0.0.1 as the DNS server, the ISP's default DNS servers were over wrote by mine. This was preventing me from accessing websites. It's not a big deal when I don't move my computer, I could manually enter the ISP's DNS server. But if I change places, the ISP's DNS changes.

I also tried to use google's DNS server, but it's not working in some instance. How can I reserve (or update) the ISP's DNS server without deleting 127.0.0.1 as a DNS.

Thank you in advance.

Daiwei

Posted 2013-03-24T18:52:12.297

Reputation: 103

Answers

1

I believe if you want to point http://local.dev to your localhost, you have to add entry into /etc/hosts file and not DNS. 127.0.01 is loopback interface.

eamai

Posted 2013-03-24T18:52:12.297

Reputation: 124

This is a good solution, but if I want to support wildcard DNS resolution hosts file cannot do it. – Daiwei – 2013-03-26T07:28:05.003

I assume you want to build local development system. So my method is to use web server and setup virtual host. Virtual host works with name based so you don't need an additional IP to setup wildcard domain.Good luck – eamai – 2013-03-27T01:43:24.103