DHCP and dynamic updating of DNS

0 views
Skip to first unread message

Stefan Bellon

unread,
Jun 2, 2002, 10:32:08 AM6/2/02
to
Hi all!

Sorry if this appears on the list twice, but the first posting doesn't
seem to have made it to the list from my point of view. Now I'm posting
a (slightly modified) re-send:

On my Debian GNU/Linux box I have set up BIND9 and DHCP3. Now I want
the dhcpd to update the DNS. I have read several instructions of how to
do it and "in principle" I have a working setup.

The problem is: It doesn't work for my Windows (XP) client. It works
for my other Linux client and the two RISC OS clients, but it doesn't
work for the notebook which has Windows XP installed.

The Notebook gets an IP assigned (and other things configured via
DHCP), but the DNS isn't updated.

[snipped a little bit here as I was able to fix the problem in the
leases file and the syslog error mentioned in the original posting, but
the DNS entry still isn't updated]

So, is this either a misconfiguration of the Windows notebook or can I
configure DHCP/DNS on my Linux box to handle the Windows XP DHCP client
as well?

My dhcpd.conf looks like this:

ddns-updates on;
ddns-update-style interim;
ignore client-updates;
option domain-name "localnet";
option domain-name-servers ns.localnet;
default-lease-time 86400;
max-lease-time 259200;
authoritative;
ddns-hostname = pick (option fqdn.hostname, option host-name,
concat ("dhcp-", binary-to-ascii (10, 8, "-",
leased-address)));
option host-name = config-option server.ddns-hostname;
log-facility local7;
key DHCP_UPDATE {
algorithm hmac-md5;
secret "foobar";
}
zone localnet. {
primary 127.0.0.1;
key DHCP_UPDATE;
}
zone 0.168.192.in-addr.arpa. {
primary 127.0.0.1;
key DHCP_UPDATE;
}
subnet 192.168.0.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option ntp-servers roma.localnet;
range 192.168.0.100 192.168.0.105;
}

And the named.conf looks like this:

options {
directory "/var/cache/bind";
auth-nxdomain no; # conform to RFC1035
allow-transfer { localhost; };
allow-query { 192.168.0.0/24; localhost; };
allow-recursion { 192.168.0.0/24; localhost; };
};
key DHCP_UPDATE {
algorithm HMAC-MD5;
secret "foobar";
};
zone "." {
type hint;
file "/etc/bind/db.root";
};
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
// add entries for other zones below here
zone "localnet" {
type master;
notify no;
file "/etc/bind/db.localnet";
allow-update { key DHCP_UPDATE; };
};
zone "0.168.192.in-addr.arpa" {
type master;
notify no;
file "/etc/bind/db.192.168.0";
allow-update { key DHCP_UPDATE; };
};

Thanks a lot for any ideas and hints!

--
Stefan Bellon * <mailto:sbe...@sbellon.de> * <http://www.sbellon.de/>
PGP 2 and OpenPGP keys available from my home page

Please all, and you will please none.

Mike Rivett

unread,
Jun 2, 2002, 11:53:23 AM6/2/02
to
From past experience, it could be the windows box caching the dns entries,
try opening a cmd prompt and type "ipconfig /flushdns"

-- Mike

"Stefan Bellon" <sbe...@sbellon.de> wrote in message
news:4b4052c2...@sbellon.de...

Stefan Bellon

unread,
Jun 2, 2002, 11:59:46 AM6/2/02
to
Mike Rivett wrote:
> From past experience, it could be the windows box caching the dns
> entries, try opening a cmd prompt and type "ipconfig /flushdns"

No, this didn't help. But I don't understand this suggestion anyway. I
don't want that the client does the DNS update. I want the DHCP server
to do the DNS update. Have I misunderstood something?

TIA.

--
Stefan Bellon * <mailto:sbe...@sbellon.de> * <http://www.sbellon.de/>
PGP 2 and OpenPGP keys available from my home page

Hi! I'm a .signature virus!
Copy me into your ~/.signature to help me spread!

Mike Rivett

unread,
Jun 2, 2002, 12:27:50 PM6/2/02
to
I see, I did not realize that the dns server itself was not updating, I
thought it was just the client.

-- Mike

"Stefan Bellon" <sbe...@sbellon.de> wrote in message

news:4b405ac8...@sbellon.de...

Mark Damrose

unread,
Jun 4, 2002, 9:07:31 AM6/4/02
to
"Stefan Bellon" <sbe...@sbellon.de> wrote in message
news:4b4052c2...@sbellon.de...

> Hi all!
>
> Sorry if this appears on the list twice, but the first posting doesn't
> seem to have made it to the list from my point of view. Now I'm posting
> a (slightly modified) re-send:
>
> On my Debian GNU/Linux box I have set up BIND9 and DHCP3. Now I want
> the dhcpd to update the DNS. I have read several instructions of how to
> do it and "in principle" I have a working setup.

I have a BIND 9.2.0 DHCP 3.0.1rc7 combination that works fine - XP included,
so they do work together.

>
> The problem is: It doesn't work for my Windows (XP) client. It works
> for my other Linux client and the two RISC OS clients, but it doesn't
> work for the notebook which has Windows XP installed.
>
> The Notebook gets an IP assigned (and other things configured via
> DHCP), but the DNS isn't updated.
>
> [snipped a little bit here as I was able to fix the problem in the
> leases file and the syslog error mentioned in the original posting, but
> the DNS entry still isn't updated]
>
> So, is this either a misconfiguration of the Windows notebook or can I
> configure DHCP/DNS on my Linux box to handle the Windows XP DHCP client
> as well?
>
> My dhcpd.conf looks like this:
>
> ddns-updates on;
> ddns-update-style interim;
> ignore client-updates;
> option domain-name "localnet";
> option domain-name-servers ns.localnet;
> default-lease-time 86400;
> max-lease-time 259200;
> authoritative;
> ddns-hostname = pick (option fqdn.hostname, option host-name,
> concat ("dhcp-", binary-to-ascii (10, 8, "-",
> leased-address)));
> option host-name = config-option server.ddns-hostname;

I'm not sure what you are trying to do here. I don't do any hostname
munging. What happens if you leave that out? When I need to force a
particular hostname (e.g. JetDirects, where I can't modify the hostname on
the client) I use a host entry:

host hostname-I-want {
hardware ethernet xx:xx:xx:xx:xx:xx;
ddns-hostname "hostname-I-want";
ddns-domainname "domain";
}

Everything else looks fine.

What does the lease look like in your leases file? Are there any error
messages in Syslog? Does your XP hostname have unicode or other illegal DNS
characters?

Stefan Bellon

unread,
Jun 4, 2002, 9:30:00 AM6/4/02
to
Mark Damrose wrote:
> "Stefan Bellon" <sbe...@sbellon.de> wrote in message
> news:4b4052c2...@sbellon.de...

[snip]

> > ddns-hostname = pick (option fqdn.hostname, option host-name,
> > concat ("dhcp-", binary-to-ascii (10, 8, "-",
> > leased-address)));
> > option host-name = config-option server.ddns-hostname;

> I'm not sure what you are trying to do here. I don't do any hostname
> munging. What happens if you leave that out? When I need to force a
> particular hostname (e.g. JetDirects, where I can't modify the
> hostname on the client) I use a host entry:

> host hostname-I-want {
> hardware ethernet xx:xx:xx:xx:xx:xx;
> ddns-hostname "hostname-I-want";
> ddns-domainname "domain";
> }

Somebody else was suggesting to leave out the hostname munging as well.
But he told me to include ...

# Microsoft proprietary stuff:
option space MSFT;
option MSFT.release-on-shutdown code 2 = unsigned integer 32;

# Note: The vendor option "MSFT 5.0" is also used by Windows XP.
class "win2k-clients" {
match if option vendor-class-identifier = "MSFT 5.0";
send fqdn.server-update true;
send fqdn.no-client-update true;
vendor-option-space MSFT;
option MSFT.release-on-shutdown 1;
}

... into /etc/dhcp3/dhcpd.conf in order to get it working correctly for
XP machines. You you don't have such an entry? And you run Windows XP
and GNU/Linux in turn on the same hardware as well?

[snip]

> Everything else looks fine.

Oh, good. :-)

> What does the lease look like in your leases file?

lease 192.168.0.104 {
starts 2 2002/06/04 05:29:50;
ends 3 2002/06/05 05:29:50;
binding state active;
next binding state free;
hardware ethernet 00:c0:32:00:a2:db;
uid "\001\000\3002\000\242\333";
set ddns-rev-name = "104.0.168.192.in-addr.arpa.";
set ddns-txt = "31a457ab0752b48c9b5684ce2f828d30a7";
set ddns-fwd-name = "veni.localnet";
client-hostname "veni";
}
lease 192.168.0.102 {
starts 2 2002/06/04 11:04:02;
ends 3 2002/06/05 11:04:02;
binding state active;
next binding state free;
hardware ethernet 00:02:3f:34:8d:b3;
uid "\001\000\002?4\215\263";
set ddns-rev-name = "102.0.168.192.in-addr.arpa.";
set ddns-txt = "00bf2616dd9ed7fcc5cf73a4cffdf4c31d";
set ddns-fwd-name = "vici.localnet";
client-hostname "vici";
}

(host "vidi" is turned off at present, just if you wonder why there's
no lease for it ;-)

> Are there any error messages in Syslog?

Not anymore. :-)

> Does your XP hostname have unicode or other illegal DNS characters?

No, just "vici".

--
Stefan Bellon * <mailto:sbe...@sbellon.de> * <http://www.sbellon.de/>
PGP 2 and OpenPGP keys available from my home page

3 reasons for being a teacher: June, July, August

Mark Damrose

unread,
Jun 4, 2002, 10:02:08 AM6/4/02
to
"Stefan Bellon" <sbe...@sbellon.de> wrote in message
news:4b4154be...@sbellon.de...

[snip]


>
> Somebody else was suggesting to leave out the hostname munging as well.
> But he told me to include ...
>
> # Microsoft proprietary stuff:
> option space MSFT;
> option MSFT.release-on-shutdown code 2 = unsigned integer 32;
>
> # Note: The vendor option "MSFT 5.0" is also used by Windows XP.
> class "win2k-clients" {
> match if option vendor-class-identifier = "MSFT 5.0";
> send fqdn.server-update true;
> send fqdn.no-client-update true;
> vendor-option-space MSFT;
> option MSFT.release-on-shutdown 1;
> }

ignore client-updates; should do the same thing as the fqdn.server-update
true and fqdn.no-update true. The only interesting thing is
MSFT.release-on-shutdown 1; I assume that directs the XP machine to release
the lease when it shuts down. Does that work?

>
> ... into /etc/dhcp3/dhcpd.conf in order to get it working correctly for
> XP machines. You you don't have such an entry? And you run Windows XP
> and GNU/Linux in turn on the same hardware as well?

XP and Linux in turn on the same hardware - no. I didn't see that. I do
have many flavors of Windows (95, 98, NT, 2000 and XP), plus Linux and
Macintosh - but they are all 1 OS machines.

The MSFT.release-on-shutdown may be a clue here (or a red herring). Do you
get the same IP lease when you switch from XP to Linux and back? It is
possible that XP and Linux are sending different UID. The DHCP server will
treat them as unique. Even if they have the same hardware and hostname,
they will generate different leases and therefore different TXT records. If
the Linux lease has not expired and been removed from the DNS server - then
when XP boots, the TXT record it generates would not match the one
registered in DNS and it would not update.

You could:
Use different hostnames, so that there would be no conflict.
Manually release the lease before you shut down Linux.
Manually delete all the DNS info before you boot XP.
Use a host entry to override the UID and make them use the same lease.

That's odd. AFAIK, the set ddns-rev-name, set ddns-txt and set
ddns-fwd-name are not recorded in the leases file unless the DHCP server
thinks it succeded in doing the DNS update.

Stefan Bellon

unread,
Jun 4, 2002, 10:38:02 AM6/4/02
to
Mark Damrose wrote:
> "Stefan Bellon" <sbe...@sbellon.de> wrote in message
> news:4b4154be...@sbellon.de...

> [snip]
> >
> > Somebody else was suggesting to leave out the hostname munging as
> > well. But he told me to include ...
> >
> > # Microsoft proprietary stuff:
> > option space MSFT;
> > option MSFT.release-on-shutdown code 2 = unsigned integer 32;
> >
> > # Note: The vendor option "MSFT 5.0" is also used by Windows XP.
> > class "win2k-clients" {
> > match if option vendor-class-identifier = "MSFT 5.0";
> > send fqdn.server-update true;
> > send fqdn.no-client-update true;
> > vendor-option-space MSFT;
> > option MSFT.release-on-shutdown 1;
> > }

> ignore client-updates; should do the same thing as the
> fqdn.server-update true and fqdn.no-update true.

Ah, I see.

> The only interesting thing is MSFT.release-on-shutdown 1; I assume
> that directs the XP machine to release the lease when it shuts down.
> Does that work?

Yes, that works.

> > ... into /etc/dhcp3/dhcpd.conf in order to get it working correctly
> > for XP machines. You you don't have such an entry? And you run
> > Windows XP and GNU/Linux in turn on the same hardware as well?

> XP and Linux in turn on the same hardware - no. I didn't see that.
> I do have many flavors of Windows (95, 98, NT, 2000 and XP), plus
> Linux and Macintosh - but they are all 1 OS machines.
>
> The MSFT.release-on-shutdown may be a clue here (or a red herring).
> Do you get the same IP lease when you switch from XP to Linux and
> back?

Since I added the above Microsoft-specific stuff (and removed the
hostname munging) I get the same IP. Before I was getting different IPs
for XP and Linux, but the DNS database wasn't updated, so it was
correct only for one OS and not for the other.

> It is possible that XP and Linux are sending different UID.

XP is sending a UID, Linux isn't. At least according to the leases file.

> The DHCP server will treat them as unique. Even if they have the
> same hardware and hostname, they will generate different leases and
> therefore different TXT records.

Interestingly enough the TXT records are the same. According to the
leases file again.

> If the Linux lease has not expired and been removed from the DNS
> server - then when XP boots, the TXT record it generates would not
> match the one registered in DNS and it would not update.

This doesn't match my experience somehow. The TXT record is the same,
regardless of running XP or Linux.

> You could:
> Use different hostnames, so that there would be no conflict.
> Manually release the lease before you shut down Linux.

Can't this be configured the way it can be configured for Windows?

> Manually delete all the DNS info before you boot XP.
> Use a host entry to override the UID and make them use the same lease.

Hm.

[snip]

Well, it *has* succeeded in doing the DNS update. This is the content
of the leases file with the Microsoft-specific stuff added and the
hostname munging removed. Then it works. I haven't tested however
whether it's due to the hostname munging alone, the Microsoft-specific
stuff alone or both in combination.

--
Stefan Bellon * <mailto:sbe...@sbellon.de> * <http://www.sbellon.de/>
PGP 2 and OpenPGP keys available from my home page

I started out with nothing and I still have most of it left.

Mark Damrose

unread,
Jun 4, 2002, 11:13:25 AM6/4/02
to
"Stefan Bellon" <sbe...@sbellon.de> wrote in message
news:4b415af8...@sbellon.de...
[snip]

>
> Since I added the above Microsoft-specific stuff (and removed the
> hostname munging) I get the same IP. Before I was getting different IPs
> for XP and Linux, but the DNS database wasn't updated, so it was
> correct only for one OS and not for the other.
>
> > It is possible that XP and Linux are sending different UID.
>
> XP is sending a UID, Linux isn't. At least according to the leases file.
>
> > The DHCP server will treat them as unique. Even if they have the
> > same hardware and hostname, they will generate different leases and
> > therefore different TXT records.
>
> Interestingly enough the TXT records are the same. According to the
> leases file again.
>
> > If the Linux lease has not expired and been removed from the DNS
> > server - then when XP boots, the TXT record it generates would not
> > match the one registered in DNS and it would not update.
>
> This doesn't match my experience somehow. The TXT record is the same,
> regardless of running XP or Linux.

Does it work now that they are generating the same lease/TXT record?

>
> > You could:
> > Use different hostnames, so that there would be no conflict.
> > Manually release the lease before you shut down Linux.
>
> Can't this be configured the way it can be configured for Windows?

That would depend on a lot of things. There are 3 different (that I know
of) dhcp clients for Linux. I doubt any of them will accept a "release on
shutdown" option over the wire. If you run kill scripts on shutdown, you
could include a dhcp release in the script that shuts down networking.
However, if Linux and XP are both using the same lease it shouldn't be an
issue. Note that the DHCP server does not attempt to update DNS every time
the lease is renewed. Only when it is first issued, when it is release (or
expires), or when the host name changes.


Stefan Bellon

unread,
Jun 4, 2002, 11:36:31 AM6/4/02
to
Mark Damrose wrote:
> "Stefan Bellon" <sbe...@sbellon.de> wrote in message
> news:4b415af8...@sbellon.de...

[snip]

> > This doesn't match my experience somehow. The TXT record is the


> > same, regardless of running XP or Linux.

> Does it work now that they are generating the same lease/TXT record?

I think I didn't make it clear enough: The TXT record has always been
the same, regardless of whether Windows XP or Linux was running, and
still the described problem occurred.

But adding said Microsoft-specific lines into dhcpd.conf and removing
the hostname munging from it seems to have solved the problem.

> > > You could:
> > > Use different hostnames, so that there would be no conflict.
> > > Manually release the lease before you shut down Linux.
> >
> > Can't this be configured the way it can be configured for Windows?

> That would depend on a lot of things. There are 3 different (that I
> know of) dhcp clients for Linux. I doubt any of them will accept a
> "release on shutdown" option over the wire. If you run kill scripts
> on shutdown, you could include a dhcp release in the script that
> shuts down networking.

This somehow doesn't please me. My main intention in setting up a DHCP
and DNS server was, that there's one central place where I configure
everything and that I don't have to configure every client on it's on.
This was the situation that I had before when I had static IPs and all
the entries in every other computer's hosts file. I wanted to get rid
of the maintaining overhead. If I have to configure every DHCP client,
then this isn't exactly what I hoped to achieve. It's still better
though than having static IPs and hosts files. ;-)

> However, if Linux and XP are both using the same lease it shouldn't
> be an issue. Note that the DHCP server does not attempt to update
> DNS every time the lease is renewed. Only when it is first issued,
> when it is release (or expires), or when the host name changes.

Yes, that's how I understood it and how it works now. But somehow it
didn't before doing said changes. And it's still not logical to me why
it now works when XP releases its lease, but Linux doesn't.

--
Stefan Bellon * <mailto:sbe...@sbellon.de> * <http://www.sbellon.de/>
PGP 2 and OpenPGP keys available from my home page

3 reasons for being a teacher: June, July, August

Mark Damrose

unread,
Jun 4, 2002, 2:47:29 PM6/4/02
to
"Stefan Bellon" <sbe...@sbellon.de> wrote in message
news:4b416053...@sbellon.de...

Sorry. I guess I need to learn not to answer questions that don't help with
the original problem :-}

>
> > However, if Linux and XP are both using the same lease it shouldn't
> > be an issue. Note that the DHCP server does not attempt to update
> > DNS every time the lease is renewed. Only when it is first issued,
> > when it is release (or expires), or when the host name changes.
>
> Yes, that's how I understood it and how it works now. But somehow it
> didn't before doing said changes. And it's still not logical to me why
> it now works when XP releases its lease, but Linux doesn't.

I don't think it has anything to do with releasing the lease. I think we
both got confused because the scenario changed. I was still solving the old
problem.

You started with the 2 OS on the same box getting different IP. That
generated 2 different leases. You say that even here they were generating
the same TXT record. I'm not sure exactly why, but I think that two
different leases with the same TXT record was confusing the DHCP server.
One way to solve that would have been to have each OS release the lease -
thereby deleting the Dynamic DNS entry. Then when the other OS booted,
there would be no conflict of 2 active leases.

Now that the DHCP server is associating both OS with the same lease, there
is no conflict. I suspect it was the hostname munging - but the way to tell
would be to leave the MS specific section and add back the munging. If it
stops working, you know that's it. You could also remove *both* the munging
and the MS specific section and see if it keeps working.

Stefan Bellon

unread,
Jun 4, 2002, 4:07:44 PM6/4/02
to
Mark Damrose wrote:
> "Stefan Bellon" <sbe...@sbellon.de> wrote in message
> news:4b416053...@sbellon.de...

[snip]

> > This somehow doesn't please me. My main intention in setting up a
> > DHCP and DNS server was, that there's one central place where I
> > configure everything and that I don't have to configure every
> > client on it's on. This was the situation that I had before when I
> > had static IPs and all the entries in every other computer's hosts
> > file. I wanted to get rid of the maintaining overhead. If I have to
> > configure every DHCP client, then this isn't exactly what I hoped
> > to achieve. It's still better though than having static IPs and
> > hosts files. ;-)

> Sorry. I guess I need to learn not to answer questions that don't
> help with the original problem :-}

Don't worry. ;-)

[snip]

> > Yes, that's how I understood it and how it works now. But somehow
> > it didn't before doing said changes. And it's still not logical to
> > me why it now works when XP releases its lease, but Linux doesn't.

> I don't think it has anything to do with releasing the lease. I
> think we both got confused because the scenario changed. I was still
> solving the old problem.

Indeed, I think you're right here as well. :-)

> You started with the 2 OS on the same box getting different IP. That
> generated 2 different leases. You say that even here they were
> generating the same TXT record. I'm not sure exactly why, but I
> think that two different leases with the same TXT record was
> confusing the DHCP server. One way to solve that would have been to
> have each OS release the lease - thereby deleting the Dynamic DNS
> entry. Then when the other OS booted, there would be no conflict of
> 2 active leases.

Agreed.

> Now that the DHCP server is associating both OS with the same lease,
> there is no conflict.

Agreed. But is this the way to go? Wouldn't it be *the* solution if the
DHCP server could tell the DHCP client to release the lease when
shutting down? Thus, regardless of the OS, the lease gets freed when
the OS shuts down. This is IMHO how it should work. I think I'll have
to find a good book about DHCP. ;-)

> I suspect it was the hostname munging - but the way to tell would be
> to leave the MS specific section and add back the munging. If it
> stops working, you know that's it. You could also remove *both* the
> munging and the MS specific section and see if it keeps working.

I'll do that when I find the time, yes, I will. :-)

Thanks for your help. :-)

--
Stefan Bellon * <mailto:sbe...@sbellon.de> * <http://www.sbellon.de/>
PGP 2 and OpenPGP keys available from my home page

Microsoft shouldn't be broken up. It should be shut down. (Bruce Schneier)

Reply all
Reply to author
Forward
0 new messages