Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Configure DNS lookups from the terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Configure DNS lookups from the terminal
Authored by: emzy on Sep 15, '05 12:41:55PM

Here my little Shell Script to Set the DNS.
See the Power of the Shell:

Filename: setdsn

# Script is used to set the Nameserver Lookup under Max OS X 10.4 with the Console
# Script by Stephan Oeste <>

if [ $# -lt 2 ] ; then
echo "Use: $0 <domain> <1.Nameserver> [2.Nameserver]"
echo "Example Use: $0 example.tld"
exit 1

PSID=$( (scutil | grep PrimaryService | sed -e 's/.*PrimaryService : //')<< EOF
get State:/Network/Global/IPv4

scutil << EOF
d.add ServerAddresses * $2 $3
d.add DomainName $1
set State:/Network/Service/$PSID/DNS

Create the file
chmod +x setdns

And then use ist with (Example): setdns

CU Emzy

[ Reply to This | # ]
Configure DNS lookups from the terminal
Authored by: DylanMuir on Sep 20, '05 07:01:29PM

Cool, Emzy.

You may be interested, I contributed some scripts to for automatically dsitributing the nameserver configuration over the openvpn tunnel. You won't have to set the resolver configuration manually in that case. But your script should be great for fixing a stuffed config...


[ Reply to This | # ]