View Full Version : [ubuntu] Intrepid dhclient hook scripts not running

January 11th, 2009, 01:56 PM

I wrote a dhclient hook script when I was using Hardy, which allows me to automatically update my bind forwarders to the dhcp nameservers, whilst updating my resolv.conf to use localhost as the nameserver. This allows me to run my own personal bind server on my laptop, whilst automatically working with any network's nameservers.

The problem is Intrepid seems to no longer use dhclient-script to run these scripts.

I updated /etc/dhcp3/dhclient.conf to have the script:

script "/sbin/dhclient-script";

but with those changes I can no longer connect to the network.

Is there a new place I can put my hook script to do this? Its important that it updates the bind configuration and restarts bind, so I can't just get away with forcing the nameserver to be localhost in that conf.

For reference, here's the script:




echo $new_domain_name_servers | sed -e '
iforwarders {\n
s/\([^ ]\+\)\s*/ \1;\n/g

"$NAMED_INITD" restart

sed -e "
\$anameserver $BIND_IP
/^\s*nameserver/i# moved following nameserver to bind forwarders
s/^\s*nameserver/# nameserver/" -i "$RESOLV_CONF"

January 11th, 2009, 01:58 PM
I guess I should also note, running /sbin/dhclient-script manually works.

I did an upgrade to get Hardy to Intrepid

February 17th, 2009, 01:53 PM
Same problem here... dhclient3 doesn't even seem to run /sbin/dhclient-script, let alone the hooks. I still can't figure out why (or how to fix it).

February 17th, 2009, 02:43 PM
OK, found it. The problem is not with dhclient3 itself, but with NetworkManager, which invokes dhclient3 with it's own script file. This script file, however, turns out not to be a script at all, but a compiled program, which runs all files in /etc/NetworkManager/dispatcher.d, as pointed out in this bug report (https://bugzilla.redhat.com/show_bug.cgi?id=446631).

So I guess it's not a bug, but a feature (albeit undocumented).

March 8th, 2009, 08:45 PM
I have made a solution to this problem, so that dhclient calls the hooks as well as NetworkManager's script.


Thanks for your help. I wouldn't have been able to figure this out without it.