What do DHCP Lease Time and Domain Name do

dhcp

Why do we need to set a lease time to a DHCP server? What happens to a client who uses that IP address while it was expired? If i set its time to 100 years, what difference does it make?

Also, i don't know why we have to set a domain name to a DHCP server. What's the idea behind it?

Best Answer

IP addresses are resources in TCP/IP networking, and they need to be managed. You can do that manually (setting all computers to static IP addresses) or you can use a DHCP server that does the management for you, based on the rules as described in RFC1531.

When a client asks for an IP address, and the DHCP server is about to "lease" the address to the client, the server has to know how long this lease should be. If leases were of indefinite length, then as soon as all IP addresses have been leased, you could not connect any new clients, even if the computers using the previously leased addresses had all stopped working. If leases were of length zero, there would be no point having them.

If a lease expires, then the server sees this a sign that this IP address can now be re-used, i.e. assigned to a different client. Should a computer use the address without the knowledge of the DHCP server, then you can end up with two computers using the same address, which would create chaos on your network (since both computers would be answering the same queries simultaneously, and these two could not talk to each other, as they would be effectively just talking to themselves).

Setting the default lease time (or any lease time for a particular lease) to 100 years makes this IP address (or any addresses leased with that time) unavailable for 100 years. As TomTom already said, this would for all intents and purposes disable the benefits of having DHCP.

Your last question doesn't make much sense, since it lacks clarity of detail. There are several options in a DHCP server that deal with DNS:

  1. When the DHCP server is instructed to hand out fixed IP addresses for particular clients, a DDNS hostname can be defined. This allows the DHCP server to dynamically update an identified DNS server, so that name resolution is provided for that client.
  2. If the client is configured to provide a hostname to the DHCP server, then dynamic DNS updates can take place using that hostname
  3. DHCP servers do not only provide IP addresses, they can provide a whole range of configuration options to the client (DHCP stands for Dynamic Host Configuration Protocol). One of these options is to tell the client which DNS servers to use for name resolutions. If you do not configure this option, then each client has to be configured manually for DNS resolution (which sort of defeats the idea of DHCP).
  4. If none of the above answer your question, then please clarify what exactly the question was.