[lug] attbi troubles

Robert Judd rjudd at mlug.missouri.edu
Mon Dec 10 14:51:44 MST 2001


>
> dhcpcd -k
> dhcpcd -dR -l 99999999 -s <ip-address> ethX
>

Ooops, make that

dhcpcd -k ethX
dhcpcd -dR -l 99999999 -s <ip-address> ethX

Another thing, if you are running some sort of firewall whose rules are
hardcoded using your IP address, then you can create an executable script

/etc/dhcpc/dhcpcd-ethX.exe

that contains some perl or sed code to change all occurrences of the old
IP to the new.  This script is only run when the IP changes, and is called
with a single argument of the new IP.

Suppose you have files file1, file2, file3 with your old IP, and in the
first ten lines file1 has the line '# OLDIPADDR=xxx.yyy.zzz.www', then you
can do something like

#! /bin/bash

NEWIPADDR=$1
OLDIPADDR=`head file1 | grep OLDIPADDR | sed 's/.*=//'`
perl -pi -e s/$OLDIPADDR/$NEWIPADDR/g file1 file2 file3

/etc/rd.d/init.d/named stop
/etc/rd.d/init.d/ipchains restart
/etc/rd.d/init.d/named start


Cheers, Rob





More information about the LUG mailing list