Results 1 to 5 of 5

Thread: Intrepid dhclient hook scripts not running

  1. #1
    Join Date
    Jan 2009
    Beans
    5

    Intrepid dhclient hook scripts not running

    Hi

    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:

    /etc/dhcp3/dhclient-exit-hooks.d/zzzzz_bind-forwarders:

    #!/bin/bash
    BIND_IP=127.0.0.1

    NAMED_FORWARDERS=/etc/bind/named.conf.forwarders
    NAMED_INITD=/etc/init.d/bind9
    RESOLV_CONF=/etc/resolv.conf

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

    "$NAMED_INITD" restart

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

  2. #2
    Join Date
    Jan 2009
    Beans
    5

    Re: Intrepid dhclient hook scripts not running

    I guess I should also note, running /sbin/dhclient-script manually works.

    I did an upgrade to get Hardy to Intrepid

  3. #3
    Join Date
    Oct 2005
    Beans
    13

    Re: Intrepid dhclient hook scripts not running

    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).

  4. #4
    Join Date
    Oct 2005
    Beans
    13

    Thumbs down Re: Intrepid dhclient hook scripts not running

    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.

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

  5. #5
    Join Date
    Jan 2009
    Beans
    5

    Re: Intrepid dhclient hook scripts not running

    I have made a solution to this problem, so that dhclient calls the hooks as well as NetworkManager's script.

    http://www.webtatic.com/blog/2009/03...hclient-hooks/

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •