dhclient ifconfig down up?

Jeff Sadowski jeff.sadowski at gmail.com
Wed May 30 23:05:44 UTC 2007


I know this is probably a common question and I see the answer to why
you do it in the scripts in the scripts themselfs but isn't there a
better way?

so here is my proposed solution

arplist=`arp |grep $interface |grep -v incomplete |awk '{ printf $1 "\n"}'`
for arp in $arplist; do
arp -d $arp
done
routelist=`route |grep $interface`
destinationlist=`echo -e "$routelist" |awk '{ printf $1 "\n"}'`
masklist=`echo -e "$routelist" |awk '{ printf $3 "\n"}'`
x=0
for destination in $destinationlist; do
let x=$x+1
mask=`echo $masklist|awk "{ printf \\$$x \\"\\n\\"}"`
route del -net $destination netmask $mask dev $interface
done

this will get rid of all routes and arps for that interface.


More information about the dhcp-hackers mailing list