- This topic has 3 replies, 4 voices, and was last updated 17 years ago by
benfeea1.
-
AuthorPosts
-
February 27, 2008 at 8:45 pm #371685
jlevitsk
ParticipantSince network interfaces don’t exist until the image runs the first time I was wondering if anyone could share how they configure things like DNS suffix search order? Or really anything else. I have a little tweaks StartupItem that I’m injecting to try and set things… just trying to save time if someone else already looked in to the different pmset things to set power stuff and how to set DNS suffixes… all that jazz…
thanks in advance for any and all replies…
February 27, 2008 at 11:21 pm #371691Patrick Gallagher
ParticipantSearch domains can be set with networksetup.
networksetup -setsearchdomains “Built-in Ethernet” dept1.company.com dept2.company.com
March 24, 2008 at 3:09 pm #371975benfeea1
ParticipantThe problem I ran into was that different Macs have different names for the network ports.
Some call it “Built-in Ethernet” others call it “Ethernet 1” Then of course there are wireless connections.I came up with this to find all the ethernet port and configure them.
This runs as a StartupItem.
———————————————
#!/bin/sh
#
# The purpose of this script is to configure the search doamin, and
# AppleTalk for each network service.
#
# Ensure we are running this script as root
if [ “`whoami`” != “root” ] ; then
echo “script must be run as root”
exit
fi
#
## Variables
searchdomain1=”yoursearchdomain.com”# set working directory.
cd /
# create a file of the Network Services.
networksetup -listallnetworkservices > private/tmp/NetworkServices1.ls
# Remove any line that begins with “An asterisk”, any line that begins with “*”,
# and any line that is blank from NetworkServices1.ls and save it as NetworkServices.ls
sed -e ‘/^[An asterisk]/d’ -e ‘/^[*]/d’ -e ‘/^$/d’ private/tmp/NetworkServices1.ls > private/tmp/NetworkServices.ls
rm private/tmp/NetworkServices1.ls
echo The NetworkServices on this system are `cat private/tmp/NetworkServices.ls`
#
# Begin loop
# Configure the Network Settings
ConfigureNetworkSettings () {while read NetworkServicesfromls; do
#
networksetup -setsearchdomains “$NetworkServicesfromls” $searchdomain1
networksetup -setappletalk “$NetworkServicesfromls” onecho configured $NetworkServicesfromls
done
}# end loop
# run the loop using the list created from `networksetup -listallnetworkservices`
ConfigureNetworkSettings < /private/tmp/NetworkServices.ls rm /private/tmp/NetworkServices.ls #Harikari srm -rf /Library/StartupItems/JHUAPLNetworkSettings exit 0 -
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed