MazeRat7
(1000+ posts)
Send PM |
Profile |
Ignore
|
Thu Nov-18-04 04:59 PM
Original message |
| Take that ISP!!! - Scripts of necessity for the house. |
|
So for the past month or so my cable ISP has been changing DNS servers on me like once or twice a week. Since I use dhclient (RedHat) to get leases from them and it updates resolv.conf...no problem for my front box. However, all the dhcp clients on my local network stop working because the dhcpd.conf file now has the wrong name server entries.
Well, I got tired of going in editing and restarting dhcpd and thought I would share my solution in case anyone else has had the same issue.
The fix goes like this (on a RedHat system at least)...
dhclient manages leases and also calls /sbin/dhclient-script (which is who generates the local resolv.conf file). Hiding inside dhclient-script is a call out to /etc/dhclient-exit-hooks and /etc/dhclient-enter-hooks. Yup, the rest should be obvious, create a dhclient-exit-hooks file to read the nameservers from resolv.conf, update dhcpd.conf, and then restart the local dhcpd.
I will add, rather then doing all that in shell script, I simply called a perl script to do all the heavy lifting for me. Which of course I am willing to share if anyone is interested.
Ok thats it. Just one of the petty problems that when you get really tired of... you go and fix.
MZr7
|