[Dnsmasq-discuss] writing a dhclient-exit-hooks script to manage dnsmasq

Rance Hall ranceh at gmail.com
Fri Jul 10 02:05:23 BST 2009

On Thu, Jul 9, 2009 at 9:26 AM, Brad Morgan<b-morgan at concentric.net> wrote:
> I use dyndns.com for my home system and my IP hasn't changed in 6 months.
> There's a configurable parameter in the script I use that says how often to
> send an update even if the IP hasn't changed. The script was obtained from
> the dyndns.com site, I didn't write it.
> Regards,
> Brad

Brad, and the rest of the crew.....

I was able to solve my problem, thanks to Brads suggestion and others
on this list I started researching dyndns providers, and dyndns.com
seemed like a better fit for what I wanted to do.

so I signed up, got an even better domain to have a subdomain on

and the perl script that Brad refered to also comes with a cron setup
file for use in /etc/cron.d and a sample /etc/dhclient-exit-hooks
script so that your dyndns
gets updated on a regular basis AND whenever you get a new IP address.

Darn Nifty

As to my resolv.conf problem I ended up solving it this way:

I could not change the dhclient-script to change the name of the
resolv file without changing core system scripts that would be
overwritten on the next update/upgrade.

so I now have three resolv files


.perm is the permanant resolv file whose nameserver line is self-referencing
.forwards is the one I ask dnsmasq to use.

As part of my dhclient-exit-hooks script I execute this code just
before the dhclient-exit-hooks script wants to get out to the internet
to update my dyndns server.

cp -f /etc/resolv.conf /etc/resolv.conf.forwards && cp -f
/etc/resolv.conf.perm /etc/resolv.conf

and thats just that simple.

I did end up with one question -- assuming dnsmasq is polling the resolv file
how long should I wait between replacing the file and trying to get on the net.

Im wondering if a "sleep 1" or something needs to go after the resolv
file business and a dyndns update.

thanks all for your insight and patience as I worked this one out.

More information about the Dnsmasq-discuss mailing list