1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
<html>
<head>
<title>DHCP and Dynamic DNS</title>
</head>
<body bgcolor="ffffff">
<h1>DHCP and Dynamic DNS -- v0.16</h1>
<p>All of the attempts I have seen to tie DHCP and DNS together have ignored
the dynamic update capacity of Bind 8. I wrote these Perl scripts to remedy
that situation.
<h2>Contents</h2>
<table>
<tr>
<td><b>ddns.cron.pl</b>
<td>a cron script to check for changes to the dhcp.leases file.
<tr>
<td><b>ddns.pl</b>
<td>the script that does the actual work of creating the update instructions for nsupdate and BIND 8.
<tr>
<td><b>ndc.cron.pl</b>
<td>a cron script to force named to write all changes to disk and reload its databases.
<tr>
<td><b>dnsupdate.pl</b>
<td>perl script to make it easier to add and delete entries manually to DNS.
</table>
<h2>Instructions</h2>
<ol>
<li>Copy the scripts to a directory. I suggest using a directory dedicated to the dhcp-dns function but that is not necessary. I use /root/DHCP-DNS.
<li>Change the following in the scripts:
<table>
<tr>
<td>In <b>ddns.cron.pl</b>:
<tr>
<td>my $DDNSHOME="/root/DHCP-DNS";
<td># Wherever you copied the scripts to.
<tr>
<td>my $DHCPD="/etc/dhcpd.leases";
<td># the location of your dhcpd leases file
<tr>
<td>my $DOMAIN="cyp.ugsolutions.com";
<td># The domain the dhcp addresses belong to.
<tr>
<td>my $NSUPDATE="/usr/bin/nsupdate";
<td># The location of nsupdate on your system.
</table>
<table>
<tr>
<td>In <b>ndc.cron.pl</b>:
<tr>
<td>my $DDNSHOME="/root/DHCP-DNS";
<td># same place as $DDNSHOME above
<tr>
<td>my $NDC="/usr/sbin/ndc restart";
<td># the command to force named to flush its buffers and reread the zone information.
</table>
<li>Assuming you already have dhcpd and Bind 8 running, use crontab to call the programs at appropriate intervals. I call <b>ddns.cron.pl</b> every five minutes and
<b>ndc.cron.pl</b> every four hours.
</ol>
<h2>ddnsupdate.pl</h2>
<p>This is a perl script to aid in making dynamic changes to a running named. Right now it allows new A and PTR records to be added and deleted.
Syntax is:
<blockquote>
<code>dnsupdate.pl add <name.domain> <ip address></code><br>
Adds a an A and a PTR record for <code><name.domain></code>
<p><code>dnsupdate.pl delete <name.domain></code><br>
Deletes any A or PTR records for <code><name.domain></code>
</blockquote>
<p>It is very important to include the domain name.
<h2>Setting up BIND 8 to allow dynamic updates.</h2>
<p>To use dynamic DNS, you must have your named.conf set up to allow it. This
is accomplished by using the <i>allow-update</i> directive in your named.conf
file. For example:
<pre>
zone "high-g.prv" {
type master;
file "local.db";
allow-update {192.168.1.10;};
};
zone "1.168.192.in-addr.arpa" {
type master;
file "192.168.1.db";
allow-update {192.168.1.10;};
};
</pre>
<p>The address in the braces is the address of the computer that is allowed
to update the running named dynamically.
<p>It is very important that every zone you want to update dynamically have
the allow-update directive. A common mistake is to allow updates in the
forward lookup zone (A records) but forget to add the allow-update directive
to the reverse lookup zone (PTR records)
<h2>Known Bugs</h2>
One user reports that nsupdate.pl does not work correctly with bind 8.2: The reverse record (PTR) will be created but the forward record (A) will not. I have been unable to duplicate the problem so if any one has a clue why this happen please let me know.
<hr>
<address><a href=mailto:carville@cpl.net>Stephen Carville</a></address>
<!-- Created: Mon Mar 22 17:10:10 PST 1999 -->
<!-- hhmts start -->
Last modified: Wed May 19 21:21:57 PDT 1999
<!-- hhmts end -->
</body></html>
|