How can I change my DNS server from the Terminal on Mac OS X? [I need this because my DNS is not working correctly with my VPN. Sometimes it's using the DNS for my main connection, and sometimes it's using the DNS specified for the VPN (which it should).]
|
feedback
|
|
You can use > open > d.init > d.add ServerAddresses * 8.8.8.8 9.9.9.9 > set State:/Network/Service/PRIMARY_SERVICE_ID/DNS > quit Instead of using The only problem is this is not persistent across reboots. If you want permanent changes, you'll want ncutil. The reason editing | |||||||||||
feedback
|
|
You can use
eg (having the Airport connection use Google's DNS Servers)
You can find out the name of the network service by running This is the same as if you were to edit the entires in the Network Preference Pane in System Preferences, so it is persistent across reboots. You may be running into a DNS issue on Snow Leopard that occurs when the order DNS servers are queried changes (see question 84144)) | |||
feedback
|
|
You should be able to do it by editing /etc/resolv.conf (remember resolv.conf is reset after reboot), hope it helps - http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man5/resolver.5.html | |||||||
feedback
|
