On 3/28/06, Peter Bako <[EMAIL PROTECTED]> wrote:
> Is there any way to get the DHCPD.CONF file be set to use the DNS
> information from the resolv.conf file?

nms=`awk '{ if ($1 == "nameserver") print $2 }' < /etc/resolv.conf`
nms=`echo $nms | sed 's/ /, /g'`
sed -n '/domain-name-servers.*/{s/servers.*/servers '"$nms"';/g;};p' <
/etc/dhcpd.conf > /tmp/$$
diff /etc/dhcpd.conf /tmp/$$
if [ $? -ne 0 ]; then
        mv /tmp/$$ /etc/dhcpd.conf
else
        rm -f /tmp/$$
fi

as an added bonus, a cron job will mail you the diff when the dns does change.

Reply via email to