Zovirl Industries

Mark Ivey’s weblog

How to set up dhcp_2_dns.sh

dhcp_2_dns.sh is a script which updates tinydns with addresses handed out by dhcpd. This is useful for Bering firewalls because DNS and DHCP will be synchronized.

Here’s how to set it up:

  1. First, make sure tinydns is set up and running (directions are here).
  2. Copy dhcp_2_dns.sh onto your firewall. I put my copy in /usr/bin/. Add /usr/bin/dhcp_2_dns.sh to /var/lib/lrpkg/tinydns.list:
    ...
    usr/bin/tinydns-data
    usr/bin/dhcp_2_dns.sh
    etc/tinydns-private/
    ...
    

    (This adds dhcp_2_dns.sh to the tinydns.lrp package).

  3. Edit /etc/init.d/tinydns so that dhcp_2_dns.sh is run every time tinydns starts. Add the call near the end of set_dnscache():
    ...
        echo "" > /var/run/resetdns.pid
        /usr/bin/dhcp_2_dns.sh      # run dhcp_2_dns.sh
        RESET_DNS=Y
    }
    ...
    
  4. Back up tinydns.lrp
  5. Edit /etc/multicron-p and add dhcp_2_dns.sh to periodic():
    periodic () {
        checkfreespace
        pingcheck
        /usr/bin/dhcp_2_dns.sh
    }
    

    By default, periodic() is run every 15 minutes. This can be changed in /etc/cron.d/multicron.

  6. Back up etc.lrp