DNS Settings on Mac OS X from the command-line

> list Setup:/Network/Service/0/DNS

> show Setup:/Network/Service/0/DNS
 {
  ServerAddresses :  {
    0 : 192.168.XXX.XXX
  }
  DomainName : XXX.taglab.com
}
> show State:/Network/Global/DNS

 {
  ServerAddresses :  {
    0 : 192.168.XXX.XXX
  }
  DomainName : XXX.taglab.com
}


We can change the setting by doing:
> get Setup:/Network/Service/0/DNS
> d.show
 {
  ServerAddresses :  {
    0 : 192.168.XXX.XXX
  }
  DomainName : XXX.taglab.com
}


> d.add ServerAddresses * 130.240.19.2

> d.show
 {
  ServerAddresses :  {
    0 : 130.240.19.2
  }
  DomainName : XXX.taglab.com
}
> set State:/Network/Service/FEAFA7DE-8BE5-49ED-A115-A3E113E8753B/DNS


networksetup -getdnsservers "Built-in Ethernet"
networksetup -setdnsservers "Built-in Ethernet" 192.168.xxx.xxx 192.168.xxx.yyy


Posted

in

by

Tags: