Friday, December 23, 2005

DNS and the ActionTec Modem

he dhclient3 client runs /etc/dhcp3/dhclient-script can be extended by simply creating your own scripts under /etc/dhcp3/dhclient-*-hooks.d/. Check out the man pages for dhclient-script ($ man 8 dhclient-script) and read the HOOKS section.

What I did was just dropped the following script in as an exit hook, so it is executed after the /etc/resolv.conf is updated.

All this hack does is strip out the 192.168.1.1 crap that really doesn't work anyways.



$ cat /etc/dhcp3/dhclient-exit-hooks.d/check_actiontec_dns
BAD_IP=192.168.1.1
echo `date`: checking dns ordering for actiontec woes
grep ${BAD_IP} /etc/resolv.conf > /dev/null
if [ $? == 0 ]; then
echo removing actiontec dns entry
grep -v ${BAD_IP} /etc/resolv.conf > /tmp/resolv.conf
mv /tmp/resolv.conf /etc/resolv.conf
fi


One thing that may break for you is if you go to another wifi access point that is NOT actiontec and it only has a single 192.168.1.1 dns entry. If it did, then you'd end up with an empty /etc/resolv.conf file! Just use this script as a base....

No comments: