Your DHCP and dynamic DNS scripts

Discuss Networking
Post Reply
FreshMeat
n00b
n00b
Posts: 4
Joined: Thu Mar 27, 2003 5:26 am

Your DHCP and dynamic DNS scripts

Post by FreshMeat »

Void. Thanks heaps for the configuration example on how to set up DHCP and DNS to do auto updates. I have been looking for something like that for ages. One thing doesn't quite work though... it's bound to be something simple but I don't know enough about this stuff yet to figure out what it is. It won't update the named dns records and the only thing I can see in the logs that it might be is a "timed out". Here's the output from /var/log/messages:

Mar 27 22:27:15 tahi dhcpd: if IN A rua.voidmain.home domain doesn't exist add 43200 IN A rua.voidmain.home 192.168.0.199 add 43200 IN TXT rua.voidmain.home "31b3334f20219672b6ee07b1eddb648c5d": timed out.
Mar 27 22:27:16 tahi dhcpd: Wrote 1 leases to leases file.
Mar 27 22:27:16 tahi dhcpd: DHCPREQUEST for 192.168.0.199 from 00:c0:df:0d:0d:9d (rua) via eth1
Mar 27 22:27:16 tahi dhcpd: DHCPACK on 192.168.0.199 to 00:c0:df:0d:0d:9d (rua) via eth1

As you have probably noticed I have just used your conf files directly. I am using RH8.

Seen this before? Any ideas?
Cheers mate

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Hmmm, I agree it does look like it is timing out trying to insert the "rua" name in your named configuration. Is "named" running? Are there any "named" related error messages in your /var/log/messages?

FreshMeat
n00b
n00b
Posts: 4
Joined: Thu Mar 27, 2003 5:26 am

Post by FreshMeat »

Yep, it is running:
named 26755 1 0 Mar27 ? 00:00:03 named -u named
root 26990 1 0 Mar27 ? 00:00:00 /usr/sbin/dhcpd eth1

Only good messages:
Mar 27 00:45:41 tahi named[26755]: starting BIND 9.2.1 -u named
Mar 27 00:45:41 tahi named[26755]: using 1 CPU
Mar 27 00:45:41 tahi named[26758]: loading configuration from '/etc/named.conf'
Mar 27 00:45:41 tahi named[26758]: no IPv6 interfaces found
Mar 27 00:45:41 tahi named[26758]: listening on IPv4 interface lo, 127.0.0.1#53
Mar 27 00:45:41 tahi named[26758]: listening on IPv4 interface eth0, 202.0.62.47#53
Mar 27 00:45:41 tahi named[26758]: listening on IPv4 interface eth1, 192.168.0.1#53
Mar 27 00:45:41 tahi named[26758]: command channel listening on 127.0.0.1#953
Mar 27 00:45:41 tahi named[26758]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1
Mar 27 00:45:41 tahi named[26758]: zone 0.168.192.in-addr.arpa/IN: loaded serial 1
Mar 27 00:45:41 tahi named[26758]: zone voidmain.home/IN: loaded serial 1
Mar 27 00:45:41 tahi named[26758]: zone localhost/IN: loaded serial 1
Mar 27 00:45:41 tahi named[26758]: running
Mar 27 00:45:41 tahi named: named startup succeeded

named has the right privelleges to change it's zone file (I assume):
-rw------- 1 named named 862 Mar 28 07:52 192.168.0.rev
-rw------- 1 named named 194 Dec 9 12:17 localhost.zone
-rw------- 1 named named 1404 Dec 9 12:17 named.ca
-rw------- 1 named named 426 Dec 9 12:17 named.local
-rw------- 1 named named 647 Mar 28 07:52 voidmain.home.zone

Again, I am using your setup files as they came. I did remove some A entries in the voidmain.home.zone file and added rua just now, but no change:
----------------------------
$ORIGIN .
$TTL 3600 ; 1 hour
voidmain.home IN SOA ns1.voidmain.home. root.ns1.voidmain.home. (
10
21600
1800
604800
3600 )
NS ns1.voidmain.home.
voidmain.home. IN A 192.168.0.1
MX 10 mail.voidmain.home.
TXT "Void Main Home"
$ORIGIN voidmain.home.
; Static Adresses
$TTL 259200 ; 3 days
gateway A 192.168.0.1
fw A 192.168.0.1
www.voidmain.home. IN A 192.168.0.1
ns1.voidmain.home. IN A 192.168.0.1
rua.voidmain.home. IN A 192.168.0.5
; As you can see, you can put a hostname in your domain with any address
; This file will be automatically updated when a DHCP assigns an address
$TTL 600 ; 10 minutes
---------------------------------

Thanks

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

You shouldn't have to add it manually to your zone file, that *should* be done automatically, as well as the addition of a "TXT" record and the creation of a file called /var/named/voidmain.home.zone.jnl. Is the "/var/named" directory owned by the user named and "rwx" for user?

Also, are there any messages in your client's /var/log/messages relating to a dhcp/dns problem? During the time your interface is brought up?

FreshMeat
n00b
n00b
Posts: 4
Joined: Thu Mar 27, 2003 5:26 am

Post by FreshMeat »

The /var/named directory is ok permission wise:
--------------------------------------
[root@tahi named]# pwd
/var/named
[root@tahi named]# ll -a
total 28
drwxr-xr-x 2 named named 4096 Mar 28 07:52 .
drwxr-xr-x 21 root root 4096 Feb 14 18:00 ..
-rw------- 1 named named 862 Mar 28 07:52 192.168.0.rev
-rw------- 1 named named 194 Dec 9 12:17 localhost.zone
-rw------- 1 named named 1404 Dec 9 12:17 named.ca
-rw------- 1 named named 426 Dec 9 12:17 named.local
-rw------- 1 named named 633 Mar 28 08:20 voidmain.home.zone
--------------------------------------

There are also no error in the message log, other than the timeout one. This is starting dhcpd and then named:
--------------------------------------
Mar 28 14:45:05 tahi dhcpd: Internet Software Consortium DHCP Server V3.0pl1
Mar 28 14:45:05 tahi dhcpd: Internet Software Consortium DHCP Server V3.0pl1
Mar 28 14:45:05 tahi dhcpd: Copyright 1995-2001 Internet Software Consortium.
Mar 28 14:45:05 tahi dhcpd: All rights reserved.
Mar 28 14:45:05 tahi dhcpd: For info, please visit http://www.isc.org/products/DHCP
Mar 28 14:45:05 tahi dhcpd:
Mar 28 14:45:05 tahi dhcpd: Copyright 1995-2001 Internet Software Consortium.
Mar 28 14:45:05 tahi dhcpd: All rights reserved.
Mar 28 14:45:05 tahi dhcpd: For info, please visit http://www.isc.org/products/DHCP
Mar 28 14:45:05 tahi dhcpd: Wrote 1 leases to leases file.
Mar 28 14:45:05 tahi dhcpd: Wrote 1 leases to leases file.
Mar 28 14:45:05 tahi dhcpd:
Mar 28 14:45:05 tahi dhcpd: Listening on LPF/eth1/00:e0:7d:b4:b4:27/192.168.0.0/24
Mar 28 14:45:05 tahi dhcpd: Sending on LPF/eth1/00:e0:7d:b4:b4:27/192.168.0.0/24
Mar 28 14:45:05 tahi dhcpd: Sending on Socket/fallback/fallback-net
Mar 28 14:45:05 tahi dhcpd: Listening on LPF/eth1/00:e0:7d:b4:b4:27/192.168.0.0/24
Mar 28 14:45:05 tahi dhcpd: Sending on LPF/eth1/00:e0:7d:b4:b4:27/192.168.0.0/24
Mar 28 14:45:05 tahi dhcpd: Sending on Socket/fallback/fallback-net
Mar 28 14:45:05 tahi dhcpd: dhcpd startup succeeded
-------- named startup --------------
Mar 28 14:48:59 tahi named[31930]: no IPv6 interfaces found
Mar 28 14:48:59 tahi named[31930]: listening on IPv4 interface lo, 127.0.0.1#53
Mar 28 14:48:59 tahi named[31930]: listening on IPv4 interface eth0, 202.0.62.47#53
Mar 28 14:48:59 tahi named[31930]: listening on IPv4 interface eth1, 192.168.0.1#53
Mar 28 14:48:59 tahi named[31930]: command channel listening on 127.0.0.1#953
Mar 28 14:48:59 tahi named[31930]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1
Mar 28 14:48:59 tahi named[31930]: zone 0.168.192.in-addr.arpa/IN: loaded serial 3
Mar 28 14:48:59 tahi named[31930]: zone voidmain.home/IN: loaded serial 10
Mar 28 14:48:59 tahi named[31930]: zone localhost/IN: loaded serial 1
Mar 28 14:48:59 tahi named[31930]: running
--------------------------------------

It all looks good to me... :?

The client is Windows 2000, and it seems to work fine. Is there a way of bringing up the interface from a dos box to see if it reports any errors? But it is really a server prob isn't it?

I just had a thought.... "command channel listening on 127.0.0.1#953". Could it be possible that that it's not getting to that port? Mmm, but it is listening...
tcp 0 0 tahi:rndc *:* LISTEN

Do you actually know how dhcpd communicates the necessary changes with named?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Ahhh, you didn't tell me it was Win2k, I assumed it was Red Hat 8.0 on both the server and the client. However, it shouldn't make any difference. I have a Win2k Advanced Server install in VMware and it obtains an address and updates DNS just fine. Could you paste the output of an "ipconfig /all" from a CMD prompt on your Win2k machine? And let me know the IP address of your DHCP/DNS server?

Also, you didn't configure a firewall on your Red Hat box did you (is iptables or ipchains running?)? If you are getting an address from your Red Hat box it should update DNS through the use of the /usr/bin/nsupdate command (you do have the "bind-utils" package installed right?).

I'm thinking it must be a client configuration issue. The server should create a voidmain.home.zone.jnl when a client obtains an address. That file is where the dynamic names go (it's a binary file). Apparently it isn't being created because it never gets notified of the client. You might try playing with the nsupdate command and see if you can manually try and get it to insert a name.

See man nsupdate and man dhcpd.conf also has a lot of information about dynamic DNS updates.

FreshMeat
n00b
n00b
Posts: 4
Joined: Thu Mar 27, 2003 5:26 am

Post by FreshMeat »

A strange thing just happened... it worked!! I just came home from work after the last post, restarted both dhcpd and named, booted up my windows machine and got this:
---------------------------------------------
Mar 28 20:24:06 tahi named[31930]: client 192.168.0.1#35611: updating zone 'voidmain.home/IN': update failed: 'name not in use' prerequisite not satisfied (YXDOMAIN)
Mar 28 20:24:06 tahi dhcpd: if IN A rua.voidmain.home domain doesn't exist add 43200 IN A rua.voidmain.home 192.168.0.199 add 43200 IN TXT rua.voidmain.home "31b3334f20219672b6ee07b1eddb648c5d":
domain already exists.
Mar 28 20:24:06 tahi named[31930]: client 192.168.0.1#35611: updating zone 'voidmain.home/IN': update failed: 'RRset exists (value dependent)' prerequisite not satisfied (NXRRSET)
Mar 28 20:24:06 tahi dhcpd: if IN TXT rua.voidmain.home "31b3334f20219672b6ee07b1eddb648c5d" rrset exists delete IN A rua.voidmain.home add 43200 IN A rua.voidmain.home 192.168.0.199: no such RRset.
Mar 28 20:24:06 tahi dhcpd: Wrote 1 leases to leases file.
---------------------------------------------

So I tried removing the A entry from /var/named/voidmain.home.zone for rua (that I added earlier to see if it would work) and when I enabled the interface again it worked.

I honestly don't know what has changed since the last failure. Nothing as far as I know, other than restart everything!

Thanks for your help Void, your a good man. I have to do this again on another network so it will be interesting to see how that goes. I'll let you know if I figure anything out.

Thanks again.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main »

Hmmm, so I can assume that you now have *.jnl files in /var/named?

Post Reply