How to Set DNS Servers from the Command Line of OS X with networksetup
Set OpenDNS for the first two DNS servers, and Google DNS as the third fallback:
networksetup -setdnsservers Wi-Fi 208.67.222.222 208.67.220.220 8.8.8.8
Checking DNS Settings with networksetup
This will report back whatever the current DNS settings are, if any:
networksetup -getdnsservers Wi-Fi
Clear the local DNS cache
When URLs are just not resolving the way you want it, to time to clear or flush the dns nameserver local cache:
sudo killall -HUP mDNSResponder
Revert Back and Clear All DNS Servers with networksetup
Remove any existing custom DNS server settings:
sudo networksetup -setdnsservers Wi-Fi empty
No comments:
Post a Comment