Comment mon serveur DHCP connaît-il le nom d'hôte de ma machine quand je ne l'ai pas défini dans dhclient.conf ?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Comment mon serveur DHCP connaît-il le nom d'hôte de ma machine quand je ne l'ai pas défini dans dhclient.conf ?

Message par ForumBot »

Je suis trying to resolve certains funky DNS issues related to DHCP on our network (I suspect we have more than one DHCP server running at le moment), et tandis que trying to figure that out, J'ai remarqué something strange avec a nouveau server I juste set up.

The server in question is a Xen virtual machine running Ubuntu 9.10 Server. The physical Xen server is aussi on our network, et quand I booted up le VM for le premier time in Xen (I imported it depuis a local Virtualbox VM running on mon machine, où it was running on a différent network), it got a DHCP lease depuis our office network et everything was good.

I checked le `dhclient.eth0.leases` file to see what got configured, et saw that le old DHCP lease depuis le previous network le machine was on was encore there, as well as le nouveau DHCP lease for le office network c'est currently connected to. Il y a two things J'ai remarqué right away:

-

The old DHCP lease information depuis le previous network ne have an `options host-name` line, qui I take to mean le original VirtualBox version of le VM n'était pas sending this option to le DHCP server. Or does this mean le old DHCP server didn't support le DHCP host name option? C'était using VirualBox's internal DHCP server at le time...

-

The nouveau DHCP lease information *does* have an `options host-name` line, qui includes le correct, current hostname for le server ("fozzie"). If I understand correctly, this means le server sent c'est hostname to le DHCP server on our network.

Il y a a number of things Je ne understand about tous this.

**First**, I did pas change `dhclient.conf` for le server at tout point; c'est using le par défaut configuration. In fact it contains le suivant line verbatim:

`send host-name ""`

So mon premier question is, how in le heck did it know to send le server's real hostname si le configuration n'est pas set up to send it in le premier place?

**Second**, why did le premier DHCP lease (for le old network) pas include `option host-name`, mais le second DHCP lease (on le nouveau network) did include it, si I n'ont pas touched tout of le configuration files?

All I did was export le original VirtualBox machine as an OVF, et alors import it into XenServer, so how did it magically configure mon hostname via DHCP si c'est pas even configured avec le actual hostname in `dhclient.conf`?

**Third**: When I run `hostname`, le server returns `fozzie.our.domain`, mais `dhclient.eth0.leases` says le hostname option was set to `fozzie` (no domain). How did it know to strip off le domain?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Comment mon serveur DHCP connaît-il le nom d'hôte de ma machine quand je ne l'ai pas défini dans dhclient.conf ?

Message par ForumBot »

OK, après a long time trawling le Internet et trying to read through `man` pages, I mostly figured out quel est going on:

>


[H]ow in le heck did it know to send
le server's real hostname si the
configuration n'est pas set up to send it
in le premier place?

Apparemment, `send host-name ""`, et more specifically, ``, has special significance on Ubuntu. It tells `dhclient` to send votre machine's current hostname to le DHCP server. Note that this is case-sensitive (i.e. si you type ``, dhclient will send le literal text `` to le DHCP server). As reported [here](http://ifireball.wordpress.com/2007/12/15/dhcp-trouble-on-debian/) et [here](http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=151820#47), this works on Ubuntu Feisty et above, being part of a patch to (ironically) fix a problem avec `dhclient` pas sending le machine's hostname par défaut.

>


[W]hy did le premier DHCP lease (for the
old network) pas include option
host-name, mais le second DHCP lease
(on le nouveau network) did include it,
si I n'ont pas touched tout of the
configuration files?

This juste seems to be parce que pas tous DHCP servers will echo le hostname back to le client. Yesterday we encore using a Linux-based ClarkConnect router as our DHCP server, qui echoed le hostname back to chaque client. Today we disabled DHCP on that server, et switched to using le built-in DHCP server on our primary domain controller. Our DHCP leases depuis le PDC ne include `option host-name` either, mais it ne seem to affect anything. The machines get updated in DNS, et they can tous find chaque autre by hostname.

>


When I run `hostname`, le server
returns `fozzie.our.domain`, but
`dhclient.eth0.leases` says le hostname
option was set to `fozzie` (no domain).
How did it know to strip off the
domain?

Ceci est me pas fully understanding le intricacies of DHCP. Our DHCP server was set to configure tous of our clients avec our domain. Je suis guessing le DHCP server was smart enough to supprimez le domain name portion depuis le hostname sent by le client.

Anyone have tout corrections ou clarifications to add to this answer? It encore seems a bit "hand-wavy", so Je ne vais pas accept it as-is.
Répondre

Revenir à « Active Directory & Entra »