Posted on 04-26-2011 08:28 AM
Is there a way to set multiple entries in this script? I need to hardcode 2 DNS servers. If I comma separate the 2 addresses in the values field it errors out as a bad IP.
# HARDCODED VALUES ARE SET HERE
networkInterface="Ethernet"
dnsServer="206.119.7.227, 204.180.94.186"
any thoughts?
...........................................................
There are grammatical errors even in his silence.
- Stanislaw J. Lec
Eric Young
eyoung1 at mac.com
Posted on 04-26-2011 08:36 AM
I'm not using the script from the resource kit, but I have used:
networksetup -setdnsservers "$service" 206.119.7.227 204.180.94.186
$service is your interface, or currently active interface. Maybe you just
don't need the comma? Not sure what that script is doing with the
variable...
Jon
Posted on 04-26-2011 08:40 AM
that was my first thought too. it does not parse the second set of quotes right.
Script Result: /private/tmp/Ethernetdnsset.sh: line 87: 204.180.94.186: command not found
Error: No DNS server has been specified.
~~~~~~~~~~
A cynic is a man who, when he smells flowers, looks around for a coffin.
--H. L. Mencken
Eric Young
eyoung at thayer.org
Posted on 04-26-2011 08:43 AM
errors as with a comma.
_-------------------_____---------------_----------__
Puritanism: The haunting fear that someone, somewhere, may be happy.
- HL Mencken
Eric Young
eyoung at thayer.org
Posted on 04-26-2011 09:29 AM
Similar to Jon, the following works for me:
#/bin/bash
servers="206.119.7.227 204.180.94.186";networksetup -setdnsservers "Ethernet" $servers
What OS version are you testing on?
Leslie N. Helou
Senior Systems Engineer
Bell Techlogix
8888 Keystone Crossing, Suite 1700
Indianapolis, IN 46240
317.704.6408
Posted on 04-26-2011 09:44 AM
Don't know if this is of any use, but we supply our dns servers as part of our dhcp along with search domains, so no local configuration required.
Sean
Posted on 04-26-2011 09:58 AM
every script can be replaced by another script.... only smaller.
works perfectly, thanks.
Posted on 04-26-2011 09:59 AM
as do we... but there is a ghost in the machine for some of our subnets that makes letting the client pull the info unreliable at best. The network admin does not believe in ghosts... so I get to hard code them :-)
-----------------------------------------------------------
Seven Dirty Habits of Highly Effluent People
1. Never follow your passion, but by all means bring it with you.
2. Beware of teamwork.
3. Vomit proudly and whenever necessary.
4. Be careful, but don't be fooled--safety is never first.
5. Think about what you are doing--never how.
6. Ignore advice such as "Work smart, not hard." It's dangerous--and moronic.
7. Consider quitting.
--Mike Rowe
Eric Young
eyoung1 at mac.com