To temporarily put your jasper machine on the old 10.24.1 network, you can alias your network adapter to your old 10.24.1.104 address like so, ifconfig en0 alias 10.24.1.104 netmask 255.255.255.0 Before, a netstat -in command showed Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll en0 1500 link#2 0.4.ac.17.48.1 6196847 0 1841562 0 0 en0 1500 10.224.88 10.224.88.20 6196847 0 1841562 0 0 lo0 16896 link#1 590448 0 596434 0 0 lo0 16896 127 127.0.0.1 590448 0 596434 0 0 lo0 16896 ::1 590448 0 596434 0 0 After the ifconfig en0 alias command, netstat -in showed Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll en0 1500 link#2 0.4.ac.17.48.1 6196865 0 1841563 0 0 en0 1500 10.224.88 10.224.88.20 6196865 0 1841563 0 0 ->en0 1500 10.24.1 10.24.1.104 6196865 0 1841563 0 0 | lo0 16896 link#1 590448 0 596435 0 0 | lo0 16896 127 127.0.0.1 590448 0 596435 0 0 | lo0 16896 ::1 590448 0 596435 0 0 | \--- Note this new line To remove it, ifconfig en0 delete 10.24.1.104 ------------------------------------------------------------------------ This was my /local/bin/net10 script from when we converted Delphion from 10.24.1.x to 10.224.88.y on Saturday, August 16, 2003. It was derived from my net9 script from November, 1997. #!/bin/ksh function Log { print - $@ >> /tmp/net10_log } we_did_something=0 if [[ $(/usr/bin/whoami) != root ]] # Be sure we are logged in as root then print "You must be logged in as root to run this command" exit 1 fi case "$@" in "test") testing=1 echo echo 'This script will first make test copies of the following files' echo ' /usr/vice/etc/CellServDB at /usr/vice/etc/CellServDB.test' echo ' /etc/hosts at /etc/hosts.test' echo ' /etc/resolv.conf at /etc/resolv.conf.test' echo 'It will then only act on those files, leaving the real versions alone.' echo 'It will also only echo the commands it would execute if you had said' echo 'net10 real, it will not execute them.' echo echo "After you run net10 for real, you would shutdown your machine and wait for" echo 'the networking infrastructure (for example, the router, AFS & DNS servers)' echo 'to get reconfigured, before rebooting.' echo echo 'This is a dangerous script. If you have any questions, ask Rick before' echo 'you run this script for real and get yourself into trouble.' echo ;; "real") testing=0 echo # echo 'This script will change your AFS & network configuration, including' # echo 'your CellServDB, I.P. address, name server, gateway, et cetera.' # echo "Although not impossible, it's a tedious process to undo what" # echo 'this script is about to do. There are backups made of each' # echo 'file this script will change at /wherever/the-original-name.10' # echo 'and there is a log kept at /tmp/net10_log.' # echo # echo 'After you run this script, you will lose all network,' # echo 'connectivity, so AFS for example, will stop working.' # echo "Don't try running this from a telnet or rlogin window." # echo "The host won't be able to send anything to your window after" # echo 'the network interfaces get reconfigured.' # echo 'Well, ok. You *could* do it from a telnet or rlogin window if you' # echo 'had to if you wanted to shutdown at the same time. For example,' # echo ' net10 real;shutdown -F should do the trick.' # echo # echo 'You should shutdown your machine after running this script and wait for' # echo 'the networking infrastructure (for example, the router, AFS & DNS servers)' # echo 'to get reconfigured, before rebooting.' # echo # echo 'This is a dangerous script. If you have any questions, ask Rick before' # echo 'you run this script and get yourself into trouble.' # echo # echo "Now, are you absolutely sure you want to run this?" # read answer # if [[ $answer = 'y' || $answer = 'Y' || $answer = 'yes' || $answer = 'YES' ]] # then echo echo 'Ok, here we go ...' # else echo # echo 'Ok, nothing was done.' # exit 2 # fi ;; ;; *) echo 'This script will make the necessary changes to an AIX machine, to implement' echo 'the Thomson-forced, networking change of all I.P. addresses from 10.24.x.y' echo 'to 10.224.88.z.' echo echo 'To use this script, type either' echo ' net10 test To just see what this script would do, or' echo ' net10 real To actually do it.' if [[ $@ != '' ]] then echo 'What you typed in was invalid.' fi echo echo 'The test option will first copy over any file that might get changed,' echo 'to a test file (e.g. /etc/resolv.conf to /etc/resolv.conf.test),' echo 'then only act on those test files. It also will only echo the commands' echo 'that would reconfigure the network. It will not execute them.' echo echo 'Backups of all the original files are made in the original directory with' echo 'a .10 suffix, and there is a log kept at /tmp/net10_log.' echo echo "When you run this for real, you will need to shutdown your machine and wait for" echo 'the networking infrastructure (for example, the router, AFS & DNS servers)' echo 'to get reconfigured, before rebooting.' echo echo 'This is a dangerous script. If you have any questions, ask Rick before' echo 'you run this script and get yourself into trouble.' echo exit 3 ;; esac if (( $testing )) then Log "----- $(/usr/bin/date +"%D %H:%M:%S"): net10 script started in test mode -----" else Log "----- $(/usr/bin/date +"%D %H:%M:%S"): net10 script started for real -----" fi original_hostname=$(/usr/bin/hostname) Log "The original hostname was $original_hostname." /usr/bin/ls -ld /usr/vice | read junk junk junk junk junk junk junk junk junk linktest link2 if [[ $linktest = "->" ]] then csdb=$link2/etc/CellServDB # The real CellServDB filename else csdb=/usr/vice/etc/CellServDB fi hosts=/etc/hosts resolv=/etc/resolv.conf if (( $testing )) then /usr/bin/cp -p $csdb $csdb.test csdb=$csdb.test /usr/bin/cp -p $hosts $hosts.test hosts=$hosts.test /usr/bin/cp -p $resolv $resolv.test resolv=$resolv.test else # If for real, make some backup files first time through. if [[ -f $csdb && ! -f $csdb.10 ]] then /usr/bin/cp -p $csdb $csdb.10 fi if [[ -f $hosts && ! -f $hosts.10 ]] then /usr/bin/cp -p $hosts $hosts.10 fi if [[ -f $resolv && ! -f $resolv.10 ]] then /usr/bin/cp -p $resolv $resolv.10 fi fi # Now do some real work. # A Delphion netstat -in command returns something like # Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll # en0 1500 link#2 0.4.ac.17.48.1 4152766 0 1619968 0 0 # en0 1500 10.24 10.24.1.104 4152766 0 1619968 0 0 # lo0 16896 link#1 307953 0 316475 0 0 # lo0 16896 127 127.0.0.1 307953 0 316475 0 0 # lo0 16896 ::1 307953 0 316475 0 0 # # We're picking out the 10.24.1 line that contains our I.P. address. # In Almaden, it was not uncommon for AIX servers to have interfaces to # multiple networks, but here at Delphion, we (essentially) have only one network. # # This code is actually counting how many network interfaces we need to change. /usr/bin/netstat -in | /usr/bin/grep " 10\.24\.1" | /usr/bin/wc -l | read a if [[ $a = 0 ]] then echo "You don't have any network interfaces that need changing." echo "No I.P. addresses were changed." Log "There were no network interfaces that need changing." else if [[ $a = 1 ]] then echo "You have 1 network interface that needs changing." Log "There is only 1 network interface that needs changing." else echo "You have $a network interfaces that need changing." Log "There are $a network interfaces that need changing." fi # Determine the current nameserver setup. # # At Almaden, the norm was to run caching-only name servers on each # machine, so /etc/resolv.conf either didn't exists, or was empty. # # At Delphion, /etc/resolv.conf points to loon (10.24.1.254) at least, # and maybe secondary DNS servers in Lisle (10.25.1.254). # # If /etc/resolv.conf exists and is not empty, then I'll set nsparms # (our name server parameters for the mktcpip command) to the Delphion # standard (Primary DNS=loon & domain=delphion.com), else to null. # if [ -s $resolv ] then nsparms="-n 10.224.88.254 -d delphion.com" else nsparms="" fi # Now for each interface that we need to change, change it. /usr/bin/netstat -in | /usr/bin/grep " 10\.24\.1" | while read interface junk junk ipaddr junk do ################################################################################# # I originally thought that the -h (hostname) option of the mktcpip command # # had/should reflect the I.P. name of an interface. For example, oak has # # three network interfaces, 2 ethernet and one token ring as follows, # # en0 129.33.10.10 host 129.33.10.10 returns OAK-E.delphion.com # # en1 129.33.24.31 host 129.33.24.31 returns 129.33.24.31 NOT FOUND # # tr0 129.33.72.10 host 129.33.72.10 returns OAK.delphion.com # # I originally was taking pains to determine the I.P. name of each interface # # with the following code, and having different -h (hostname) options for # # each of the three mktcpip commands. I now think this is wrong. All I # # need to do is use the original_hostname. # # # # For machines with multiple network interfaces, each I.P. address may # # or may not have a distinct I.P. name. Find the I.P. name for this address. # # machname=$(/usr/bin/host $ipaddr) # # machname=${machname%% *} # # Besides, the above code returned null for the "NOT FOUND" case of 24.31. # ################################################################################# machname=$original_hostname # Use original hostname rather than I.P. name. # Set default gateway & network type. gateway=10.224.88.1 networktype="-i $interface -t dix" snm=255.255.255.0 case "$ipaddr" in 10\.24\.1\.1) newaddr=10.224.88.241 ;; # afs1 10\.24\.1\.2) newaddr=10.224.88.242 ;; # afs2 10\.24\.1\.12) newaddr=10.224.88.15 ;; # elk 10\.24\.1\.22) newaddr=10.224.88.10 ;; # baboon 10\.24\.1\.23) newaddr=10.224.88.30 ;; # patimg2 10\.24\.1\.31) newaddr=10.224.88.16 ;; # gecko 10\.24\.1\.35) newaddr=10.224.88.18 ;; # giraffe 10\.24\.1\.49) newaddr=10.224.88.27 ;; # ncc-312 10\.24\.1\.60) newaddr=10.224.88.31 ;; # penguin 10\.24\.1\.62) newaddr=10.224.88.35 ;; # reindeer 10\.24\.1\.63) newaddr=10.224.88.23 ;; # lemur 10\.24\.1\.65) newaddr=10.224.88.38 ;; # sleepy 10\.24\.1\.67) newaddr=10.224.88.40 ;; # trantor 10\.24\.1\.68) newaddr=10.224.88.17 ;; # ghost 10\.24\.1\.73) newaddr=10.224.88.39 ;; # thrasher 10\.24\.1\.79) newaddr=10.224.88.37 ;; # skunk 10\.24\.1\.86) newaddr=10.224.88.19 ;; # grumpy 10\.24\.1\.89) newaddr=10.224.88.33 ;; # polecat 10\.24\.1\.93) newaddr=10.224.88.28 ;; # patimg0 10\.24\.1\.95) newaddr=10.224.88.28 ;; # orestimba 10\.24\.1\.96) newaddr=10.224.88.11 ;; # bear 10\.24\.1\.98) newaddr=10.224.88.24 ;; # lizard 10\.24\.1\.99) newaddr=10.224.88.14 ;; # chameleon 10\.24\.1\.101) newaddr=10.224.88.36 ;; # rhino 10\.24\.1\.102) newaddr=10.224.88.32 ;; # phoebe 10\.24\.1\.104) newaddr=10.224.88.20 ;; # jasper 10\.24\.1\.105) newaddr=10.224.88.29 ;; # patimg1 10\.24\.1\.107) newaddr=10.224.88.237 ;; # spectre 10\.24\.1\.108) newaddr=10.224.88.22 ;; # kestrel 10\.24\.1\.111) newaddr=10.224.88.41 ;; # walrus 10\.24\.1\.134) newaddr=10.224.88.34 ;; # raccoon 10\.24\.1\.254) newaddr=10.224.88.254 ;; # loon *) echo "Unknown network address ($ipaddr) for $interface interface." Log "Unknown network address ($ipaddr) for $interface interface." exit 234 ;; esac oldipaddr=$ipaddr echo " $interface is I.P. address $ipaddr and will be changed to $newaddr" echo Log "$interface is I.P. address $ipaddr and will be changed to $newaddr" if [[ $nsparms != "" ]] # Remove any nameserver definitions. then if (( $testing )) then echo /usr/sbin/namerslv -XI else /usr/sbin/namerslv -XI 1>/dev/null 2>&1 fi we_did_something=1 Log "Command was /usr/sbin/namerslv -XI" fi if (( $testing )) # Actually redefine the interface. then echo /usr/sbin/mktcpip -h $machname -a $newaddr $nsparms -g $gateway -m $snm $networktype else /usr/sbin/mktcpip -h $machname -a $newaddr $nsparms -g $gateway -m $snm $networktype fi we_did_something=1 Log "Command was /usr/sbin/mktcpip -h $machname -a $newaddr $nsparms -g $gateway -m $snm $networktype" done fi if [[ $(/usr/bin/hostname) != $original_hostname ]] # Then restore hostname. then if (( $testing )) then echo /usr/bin/hostname $original_hostname else /usr/bin/hostname $original_hostname fi we_did_something=1 echo "Original hostname ($original_hostname) restored." Log "Original hostname ($original_hostname) restored." fi # Check CellServDB for correctness. we_changed_csdb=0 if [[ -f $csdb ]] then # All we need do is to change 10.24.1.1 to 10.224.88.241. if /usr/bin/grep '^10\.24\.1\.1' $csdb >/dev/null then /usr/bin/cp $csdb $csdb.in # If found, change it. /usr/bin/sed 's=10\.24\.1\.1=10\.224\.88\.241=' < $csdb.in > $csdb /usr/bin/rm $csdb.in we_did_something=1 we_changed_csdb=1 echo echo 'afs1 changed from 10.24.1.1 to 10.224.88.241 in CellServDB.' Log 'afs1 changed from 10.24.1.1 to 10.224.88.241 in CellServDB.' fi else echo "I didn't find your CellServDB file in /usr/vice/etc." Log "I didn't find your CellServDB file in /usr/vice/etc." fi # Check /etc/hosts for correctness. if [[ -f $hosts ]] then # For /etc/hosts, change any occurances of my IP address. if /usr/bin/grep $oldipaddr $hosts > /dev/null then /usr/bin/cp $hosts $hosts.in /usr/bin/sed 's=$oldipaddr=$newaddr=' < $hosts.in > $hosts /usr/bin/rm $hosts.in we_did_something=1 echo echo "Your old IP address of $oldipaddr was changed to $newaddr in /etc/hosts." Log "Your old IP address of $oldipaddr was changed to $newaddr in /etc/hosts." fi else echo "I didn't find your /etc/hosts file. Your system needs one, doesn't it?." Log "I didn't find your /etc/hosts file." fi # Check /etc/resolv.conf for correctness. if [[ -f $resolv ]] then # I get kind of sloppy here in that I don't try to figure out what is in # /etc/resolv.conf first. I simply delete all nameserver entries and # add the ones I say, belong. That is, loon at 10.224.88.254 and # chiname at 10.224.89.254. And yes, do this even on loon. if (( $(namerslv -sI | grep -c '10\.2[45]\.') != 2 )) then if (( $testing )) then echo "/usr/bin/namerslv -XI" echo "/usr/bin/namerslv -a -i 10.224.88.254" echo "/usr/bin/namerslv -a -i 10.224.89.254" else /usr/bin/namerslv -XI /usr/bin/namerslv -a -i 10.224.88.254 /usr/bin/namerslv -a -i 10.224.89.254 fi we_did_something=1 echo "Set nameservers to loon (10.224.88.254) and chiname (10.224.89.254) in /etc/resolv.conf." Log "Set nameservers to loon (10.224.88.254) and chiname (10.224.89.254) in /etc/resolv.conf." fi else echo "I didn't find your /etc/resolv.conf file. Your system needs one, doesn't it?." Log "I didn't find your /etc/resolv.conf file." fi if (( $we_did_something )) then echo echo '====================================================================' if (( $testing )) then echo '= If you were running this for real, you would need to =' echo '= shutdown your system and wait for the networking =' echo '= infrastructure to be reconfigured before rebooting. =' else echo '= You should now shutdown your system and wait for the =' echo '= networking infrastructure to be reconfigured before rebooting. =' fi echo '====================================================================' fi Log "The final hostname is $(/usr/bin/hostname)." Log "----- $(/usr/bin/date +"%D %H:%M:%S"): net10 script ended -----"