# DNS update from dhcp client?

## kevquinn

I don't know if this makes sense, but here goes. I use a dual boot machine in network of Windows machines.  I get my IP address via DHCP.  When booting Windows, the name server gets updated with the relevant records (usually...).  In Gentoo, I successfully get the IP address assigned, but there's no update to the DNS.  Currently I log on to another machine and use nsupdate to fix the DNS manually.

Normally I would have expected the DHCP server to update the DNS as and when leases are granted and released/expired.  However this doesn't seem to happen.  So I'm speculating that the windows client is actually doing the DNS update to the Windows-based DNS server (which to me sounds like a stupid way of managing a network, but then it's not my network).  The windows client has a checkbox in its network configuration relating to updating dns - however I have no idea what this actually does.  Perhaps it's an "Active Directory" thing - I saw on ISC's site some (slightly disparaging) comments about Microsoft's extensions(!) to DNS to support active directory.

In a nutshell, the question is how do I mimic in Gentoo, what the Windows client does to update DNS?

And is 'nsupdate' in an ebuild somewhere?  It's not in bind-tools, and emerge -S doesn't find it.

----------

## neysx

There's nothing particular in Gentoo that you could use AFAIK and I don't know anything about windows post '98.

Letting clients update the DNS entries is nonsense.

You DHCP server should let your DNS server know about leases.

You did not mention which servers you are using.

With the classic duo DHCP/BIND, this page should help. You might also want to try dnsmasq which is an integrated dhcp/dns server and is quite easier to configure.

Why not just define a static IP in your dhcp config and use the same in your dns config?

Hth

----------

## gnuageux

Or why not just add the resolvers that you lease via dhcp to /etc/resolv.conf and call it a day?

----------

## gnuageux

....even if the IP you lease is dynamic I would think that the name servers are static. (in the sense that they dont change per session)

----------

## neysx

 *gnuageux wrote:*   

> ....even if the IP you lease is dynamic I would think that the name servers are static. (in the sense that they dont change per session)

 Could you expand on that please.

I do not understand how his name server will be able to know about the dynamic IP's his dhcp assigned unless the name server is told.

Thanks.

----------

## gnuageux

What I meant was that when you lease ip addy etc from your dns server, chances are that that server (the one running dhcp) will assign you the name servers every session. (I.e when people dial into our network the ip that they are given changes, but the name servers stay the same [unless weve been making changes]) So if he dialed in, enabled eth.whatever, he may get a different address from say 192.168.0.0/24 space on a per session basis, but I think that 99 times out of 100 hed get the same name server addresses. Being as this is the case why not just statically assign those in /etc/resolv.conf?

----------

## kevquinn

neysx; I agree totally.  The key point (that looking back I didn't make clear - sorry) is that it's not my network.  I'm just a guest on someone elses network so I don't get to say what DNS/DHCP servers they run, and it would be politically insensitive of me to tell their IT people their network is pants...

Heh; if I had control of the network, it wouldn't be using Windows for network services  :Smile: 

FWIW the servers are Windows 2000 (server, I imagine) - certainly the DNS is on Windows.  What's puzzling me is that there does seem to be some interaction between the Windows clients and the Windows server, in order to update the DNS database.  Gentoo acquires the lease with no problem (and I wouldn't expect any).  The DNS definitely doesn't get updated as a result (not that I'd expect that to be the responsibility of the client).  Since in Windows the DNS does get updated, something somewhere else is doing the update to DNS, and it seems to me that it must be Windows getting up to some tricks.

I thought I had nsupdate somewhere on a previous Gentoo incarnation - but maybe it was a different distro; memory gets foggy as time goes on  :Sad: 

Hmm; another thought - I might try faking the classid with dhcpd, see if there is something else somewhere that'll be fooled in to updating the DNS.  Just need to discover what Windows would identify itself as...

----------

## kevquinn

gnuageux: name resolvers get set up fine; dhcpcd gets them from the DNS server as normal and writes /etc/resolv.conf appropriately.

I have no trouble resolving other machines' addresses, the problem arises when another machine tries to resolve my address.  This happens when I run X apps on other machines on the network, to come up on my display for example.

I get by, either by fixing their DNS (which I probably shouldn't be editing - especially not manually; it also suffers from DNS cache lag on their system so any fixes take an hour to propogate!), by rigging DISPLAY to be numeric, or allowing all incoming X connections from the relevant remote hosts via xhost, which makes me vulnerable to pranksters.

----------

## neysx

How do you check that their DNS is not aware of your machine?

It could be that their dhcp server does assign you a hostname. Try adding the -DH dhcpcd options in /etc/conf.d/net and see what it does.

Maybe you could politely ask the net admin to assign you a static IP?

You'll get the usual sneer and "why can't you do it like everyone else does with losedows"..., just tell them they are right, you know better anyway  :Wink: 

----------

## UberLord

I don't suppose that you've confgured dhcpcd to send stuff? Specifically look into the -h parameter.

----------

## kevquinn

Thanks for the suggestions; I've given them a go.  No luck so far, however.

Added: I use dig and/or nslookup to determine what their DNS contains, both on my machine and on solaris boxes on their network.  I don't run named on my machine.

The dhcp server does give me a domain name, so '-D' is useful (instead of hard-coding it; the machine is mobile).  There's no HOSTNAME in the response (not in /var/lib/dhcpc/dhcpcd-ethX.info), so -H has nothing to work with - however on reflection since the system doesn't know my machine's name this isn't a surprise.  I did try it; dhcpcd reported "orig hostname" but no "your hostname" - with the domainname it reported both.  I'll leave it in though, as it doesn't seem to hurt and may be useful on other networks.

'-h' initially sounded very promising - but doesn't seem to have any effect on the server.  I set '-d' as well, to see if anything interesting got written to syslog but nothing much was.  From the manual, it looks like this option is to override a default hostname string, not that dhcpcd doesn't sent the hostname by default - I'm guessing it sends the actual hostname by default, but this can be overridden if necessary (manual mentions "@home" users).

BTW I think I've figured where nsupdate is - in the net-dns/bind package; however it looks like it's a link to named which would explain why emerge -S couldn't find it.  I'd avoided installing bind since I don't need to run a DNS server - but if they're the same executable and I want nsupdate I guess I need to emerge bind.

----------

## nobspangle

You can ask the people in charge of the dhcp/dns server to make a small change.

When win2k/winXP clients lease an address from the DHCP server on a win2k/2k3 domain they automatically update the DNS server. The DHCP server knows this so it doesn't try to update the DNS itself. There is a box to tick that says something like "allow DHCP to update DNS for clients that do not update directly e.g. Windows 9x".

I'm pretty sure that if you get the sysadmin to tick that box for you the DNS entry will get created by the DHCP server.

----------

## kevquinn

Just had a rummage around the 'net, and found that Windows clients do indeed initiate a DNS update via DHCP - the command "ipconfig /registerdns" forces it to re-register; normally it's done automatically when the IP lease is obtained.  Saw a few references to "option 81" proposed as an extension to DHCP.  However following up has proved bizarre.  Eventually found there was an IETF draft, "draft-ietf-dhc-fqdn-option" however it is now expired, without becoming any part of an RFC.  Found a copy of the 06 version (07 is the "deleted" version") at the ietf.  Perhaps it'll be reintroduced later - however looks like it's been pending since at least early 2000 so perhaps there's significant controversy.  The fact remains of course that Windows servers across the planet use it...

nobspangle: Thanks; I'll give that a go (er, maybe next week now  :Smile:  ).  Always easier when you can suggest exactly what they might tick...

Edit: Just had a rummage through the dhcpcd sources; "option 81" definitely isn't implemented (no surprise really, since dhcpcd follows the RFCs not IETF drafts).

Edit: And looking at the RFCs is interesting.  '-h' on dhcpcd enables option 12, which sends the host name to the server (with or without domain).  The immediate question then has to be, what on earth is the proposed option 81 for?  Surely if the DHCP server is set to update the DNS, it can use the hostname supplied in option 12.  Reading through the dns-fqdn draft, the author expects it to be quite normal for hosts which lease addresses to perform DNS updates directly.  Option 81 allows the client to control whether the DHCP server updates A and/or PTR records on its behalf; in particular it allows the client to prevent the DHCP server from updating the DNS.  It seems that on the network I'm connecting to, the DHCP server is set to update the DNS only when explicitly requested by the client - i.e. its default behaviour is to not update the DNS! I'd expect the default behaviour of the DHCP server to be to take full responsibility for updating the DNS unless option 81 is present.  Anyway, sounds like your suggestion, nobspangle, will do the trick.

----------

## kevquinn

Had a little time over the weekend, so hacked dhcpcd a bit to add "option 81" - dhcpcd source is nice and easy to follow, so it proved fairly straightforward.  Set it to ask the DHCP server to update DNS automatically, connected to the network this morning and bingo, DNS updated automatically.  I'll clean it up and propose it to the package maintainer, or maybe upstream.

----------

## chrisost

kevquinn - 

I'm running up against the same problem.  I've just finished setting up a dual boot box that's on a university network, and have the exact same problem - my windows client will resolve, but my linux client will not.  Can I get a diff of the changes you made to dhcpcd to add the option 81?

----------

## kevquinn

I've started bug number 64307 in bugzilla, and attached my current patch against the code and the -r5 ebuild:

https://bugs.gentoo.org/show_bug.cgi?id=64307

It's set for the moment to #ifdef in the changes if you add "dhc-fqdn" to your USE flags

I hope putting it into bugzilla is the right thing to do...  Should soon find out, anyway  :Smile: 

----------

## sveltegeek

I ran into this problem as well.

However, all I had to do was edit my /etc/conf.d/net file.

Example-

iface_eth0="dhcp"

dhcpcd_eth0="-h "netadm5lt""

I simply added that second line you see there, and our ddns 

picked it immediately.

jeff.

----------

## kevquinn

I tried the '-h' option earlier (suggested further back in the thread), but it doesn't work on the network I'm connecting to.  It depends on what dns/dhcp server combination is being used, of course - certainly if '-h' works, go for it.  FWIW I'm still not convinced that "option 81" is really a good idea, but it's a fact of life so I have to live with it.

----------

## stenny

 *sveltegeek wrote:*   

> I ran into this problem as well.
> 
> However, all I had to do was edit my /etc/conf.d/net file.
> 
> Example-
> ...

 

The same configuration works perfectly for all Linux clients on my network. They all get their IP address by DHCP and register perfectly with the DNS server.

But this does not work for my windows machine (Win2K).  Instead I find these error messages in the log:

```
/var/log:

log-2004-09-23-16:54:32:Sep 23 12:33:35 [dhcpd] DHCPREQUEST for 192.168.10.18 from 00:08:54:13:26:19 (ithaka) via eth0

log-2004-09-23-16:54:32:Sep 23 12:33:35 [dhcpd] DHCPACK on 192.168.10.18 to 00:08:54:13:26:19 (ithaka) via eth0

log-2004-09-23-16:54:32:Sep 23 12:33:35 [named] client 192.168.10.18#1061: updating zone 'ilias.net/IN': update failed: 'RRs

et exists (value dependent)' prerequisite not satisfied (NXRRSET)
```

What's this all about?

regards

    stefan

----------

## kevquinn

For anyone watching, I've updated the patches for -r5 and -r7, which are now the only current ebuilds for net-misc/dhcpcd.  A minor bugfix.  As before see https://bugs.gentoo.org/show_bug.cgi?id=64307

----------

