Re: dhcp server and isp's dns...
> No, that was a bit unclear. What I meant was that all the hardware
> routers I've ever owned have not had any difficulty getting DHCP and
> nameserver information and passing them on to my client computers, even
> with nameservers changing. So it seems like the most popular DHCP
> servers on one of the most configurable operating systems should be able
> to handle this as well, but I haven't seen/heard of how to do it yet....
> anyone know how?
Ok. You can do that. Something crude and very simple :
NAMESERVERS=$(
for i in $( cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f2); do
echo -n $i", ";
done | sed 's/, $//'
)
# the sed line should be a single line.
DHCPD=$(cat /etc/dhcp3/dhcpd.conf |
sed "s/^\([[:space:]]*option domain\-name\-servers\).*$/\1 $NAMESERVERS;/g")
echo "$DHCPD" > /etc/dhcp3/dhcpd.conf
/etc/init.d/dhcpd restart
Make this into a script file and call it from dhcp client hooks or from
/etc/dhclient-sciprt when nameserver info changes. Check out the man
pages for dhclient.
The better way would be to get nameserver information directly from dhcp
client, check for unexpected values and have some kind of template
dhcpd.conf. But this is just to give an idea
|