resolv.conf does not work on OSX anymore.
There is a notice right at the top of that file as follows:
#
# macOS Notice
#
# This file is not consulted for DNS hostname resolution, address
# resolution, or the DNS query routing mechanism used by most
# processes on this system.
#
# To view the DNS configuration used by this system, use:
# scutil --dns
#
# SEE ALSO
# dns-sd(1), scutil(8)
#
# This file is automatically generated.
#
Also, networksetup -listallnetworkservices
does not list all VPN interfaces.
Here is one way to use scutil to target the right interface:
1. Create a file commands.txt
with your commands for the interactive scutil tool.
e.g. contents for Pulse secure interface in my case:
get State:/Network/Service/net.pulsesecure.pulse.nc.main/DNS
d.add ServerAddresses * 8.8.8.8 9.9.9.9
set State:/Network/Service/net.pulsesecure.pulse.nc.main/DNS
- Run scutil with the commands piped in. (You need sudo for
set
)
sudo scutil < commands.txt
2@ssc Run
scutil
followed by> list
to find the key to replace PRIMARY_SERVICE_ID with. – J.Money – 2015-03-31T02:12:02.1202This does not seem to work on my Mac OSX 10.7.5 MBP, at least not when done literally. Should I replace anything in the
set State:/Network/Service/PRIMARY_SERVICE_ID/DNS
line or can I use that as it is ? Should the new DNS servers show up in thescutil --dns
output after the change ? – ssc – 2013-10-30T13:57:37.96328.8.8.8 is a valid one, though. Google's Public DNS. 8.8.4.4 is the secondary. :-) – Forgotten Semicolon – 2009-12-21T19:03:36.693
I know, I use it :) – John T – 2009-12-21T19:11:40.607
Nice, I'll be checking this out shortly. +1 for now. – Dan Rosenstark – 2009-12-21T19:16:24.530
John T, I want these servers to take priority over whatever servers are currently configured. Will it do that? – Dan Rosenstark – 2009-12-21T19:17:15.307
1It should. You can use
scutil --dns
to confirm. – John T – 2009-12-21T19:21:22.977