1

I am trying to understand what data is actually stored on a DHCP server. I understand the process of how a client gets a lease for an IP address from a server, but is it possible to poll a server for the hostname of the client that has a given IP leased?

For example: I can ask the DHCP server "What is the hostname of 192.168.1.107?" and it will return "Jim's Lenovo".

From my understanding when a client attempts to ask for a lease, the DCHP Request packet can contain the hostname depending on the option set. However, does the server hold this hostname?

3
  • I think you would need a DNS server for this. DNS is the thing that translate names to ip's and with a reverse lookup the other way around. Once you've set your default DNS to your server IP you could do nsloopup computername and it will give you IP. or reversed. Feb 28, 2017 at 22:12
  • Thank for your answer! However, I am already aware of the DNS solution, I was wondering if it's possible with DHCP.
    – Jon
    Feb 28, 2017 at 22:21
  • ietf.org/rfc/rfc2131.txt, section 2.1: "The model of DHCP persistent storage is that the DHCP service stores a key-value entry for each client, where the key is some unique identifier...The protocol defines that the key will be (IP-subnet-number, hardware-address) unless the client explicitly supplies an identifier using the 'client identifier' option." In other words, it stores the key, and the key is what the client supplies. Case in point: "Alternately, the key might be the pair (IP-subnet-number, hostname),"
    – MaQleod
    Feb 28, 2017 at 22:25

1 Answer 1

0

The DHCP server doesn't maintain a list of hostnames, but will maintain a DHCP Lease list, which would include the MAC address of the device and IP address that was assigned to it. Name resolution is something completely different.

3
  • I read on Microsoft's DHCP documentation that a client can send there hostname with through an option in the DHCP REQUEST packet. Theoretically, if this were the case, would the lease list contain that information?
    – Jon
    Feb 28, 2017 at 22:26
  • It does, if you look in a Windows Server's DHCP Lease List, if the client includes it but it is not required to do so... But I don't know of anyway you could query that other than on the server.
    – acejavelin
    Feb 28, 2017 at 22:38
  • 1
    @Jon, yes, the option to set is "client identifier" as defined in the RFC (see my comment above). The process is defined more in section 3: "The combination of 'client identifier' or 'chaddr' and assigned network address constitute a unique identifier for the client's lease and are used by both the client and server to identify a lease referred to in any DHCP messages."
    – MaQleod
    Feb 28, 2017 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .