Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On OS X Leopard, scutil gives me

$ scutil --dns
DNS configuration

resolver #1
  nameserver[0] :
  nameserver[1] :
  order   : 200000

resolver #2
  domain : local
  options : mdns
  timeout : 2
  order   : 300000


Now, how do I remove the first "resolver #1" and replace with a DNS server of my choosing?

Context: A VPN client sets this bogus DNS entry on connection, replacing my working DNS settings. I haven't been able to figure out how to stop it from doing so (see here), so now I'm trying to remove this unwanted effect ex-post, after I connect. A command line script to do this would be perfect.

I tried sudo scutil as per instructions here, but no love -- scutil --dns still reports the settings unchanged, and DNS resolution still doesn't work. Modifying /etc/resolv.conf has no effect on OS X.

share|improve this question
Did you try that? Mac OS X Lion, /etc/hosts Bugs, and DNS Resolution – user149200 Jul 30 '12 at 17:58

Well, most VPN connections I am aware of are able to push a DNS server to the VPN client. My suggestion would be to ask your VPN provider to not push the DNS server for your connection. Please note that this might have some negative impact on your VPN session.

share|improve this answer
thank you, but unfortunately that's not possible. So the OS offers no way for me to use a DNS server of my choice on my computer? – user124114 Mar 28 '12 at 20:06
Hm, OS X is still Unix. You could modifiy the /etc/resolf.conf (or the adequate counterpart of it in Unix) after you established the VPN connection. Another way might be to set an immutable bit on the file. – Valentin Mar 28 '12 at 20:34
Unfortunately, in OS X /etc/resolv.conf is auto-generated and changing it has no effect. – user124114 Mar 28 '12 at 20:43

In my experience if you specify a particular DNS server in Network preferences, even if you're using DHCP, Mac OS uses that server in preference to the one obtained through DHCP. So if you always want to use, put that in explicitly.

System Preferences -> Network -> Ethernet (left pane) should produce a window that has a "DNS Server:" text box you can fill in with the IP address of your desired DNS server. Click "Apply" to apply the change, and you're done; you shouldn't have to make this change again. (If your VPN connection is WiFi instead of Ethernet, then you should click on that instead of Ethernet above.)

share|improve this answer
Thanks, I tried this. But after connecting the VPN client, the bad DNS server is still set (overwriting the previous, working one), and I still don't know how to get rid of it :( – user124114 Mar 31 '12 at 12:02

You should have your vpn set up in your network. I have private internet access and have it manually installed in my network. My network shows Airport, Ethernet and Private Internet access.

To change my dns:

  • click on your vpn network
  • hit advanced and in options "send all traffic over VPN" should be checked
  • click the DNS tab and add your dns in the box. If you don't put any dns servers it will push to your ethernet dns settings.
  • Now to check if you are running on your dns ccp this in terminal:

    scutil --dns | grep nameserver\[[0-9]*\]
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .