Adding a DNS nameserver to OS X Leopard

To add a DNS nameserver to OS X Leopard

Summarized from these excellent articles, Overriding DHCP- or VPN-assigned DNS servers in Mac OS X Leopard, Updating OS X Network Settings to Use a Local DNS Server, and Using a Local DNS Server in Leopard

In OS X (Leopard and later) DNS entries are arranged as a hierarchy – general to specific. You need the most specific applicable entry. Order – general to specific. Output is from scutil list command.

  • State:/Network/Global/DNS
  • Setup:/Network/Service/0/DNS (Fixed Network Adapter)
  • State:/Network/Service/B5DD6BDA-F1B3-40C7-9CEC-03CF97DE7B0A/DNS (Airport Connection)
  • State:/Network/Service/com.cisco.VPN/DNS (CISCO VPN)

So, now for the commands to adjust everything

sudo scutil
list State:/Network/Service/[^/]+/DNS
[Pick the appropriate service]
show State:/Network/Service/com.cisco.VPN/DNS
[
 {
  ServerAddresses :  {
    0 : 10.1.10.211
    1 : 10.1.10.100
  }
}
]
d.init
get State:/Network/Service/com.cisco.VPN/DNS
d.add ServerAddresses 10.1.10.74 10.1.10.211 10.1.10.100
d.show
[
 {
  ServerAddresses :  {
    0 : 10.1.10.74
    1 : 10.1.10.211
    2 : 10.1.10.100
  }
}
]
set State:/Network/Service/com.cisco.VPN/DNS
^D

Remember to flush your local DNS cache after all is said and done:

(Leopard and later) dscacheutil -flushcache

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.

WordPress Themes