0

For simplicity sake, let us say, the DHCP server is running in the default gateway/router at 192.168.1.1/24

And let us say, i have connected 10 hosts to the router.

And among 10 hosts, 2 of the hosts are assigned IP addresses statically. And two statically assigned IPs are 192.168.1.2/24 and 192.168.1.3/24

And DHCP server is configured to start the DHCP pool address from 192.168.1.2/24.

Now the rest 8 hosts are configured to get IP address automatically using DHCP.

When these 8 hosts contact DHCP server for the IP address, will the DHCP server provide the IP address as 192.168.1.2/24?

If not, and it provides the IP address as 192.168.1.4, how does DHCP server know about the statically assigned IP addresses?

1
  • Unfortunately, we cannot say what a DHCP server or host will do without knowing the server or host. Unfortunately, questions about protocols above OSI layer-4 are off-topic here, as are host configurations. You could try to ask this question on Server Fault for a business network, or on Super User for a personal network.
    – Ron Maupin
    Mar 23, 2018 at 13:50

2 Answers 2

3

Any IP addresses used as a statically (locally) configured address should NOT be included in the DHCP pool. A good practice is to set up a reservation for the static host.

The DHCP server doesn't know about static addresses. It might should check an address before sending a DHCP offer but it may no be able to (when located on another subnet). In that case the client would check the address and reject the offer which isn't really nice.

7
  • 4
    Implementations certainly vary but just worth noting that the DHCP RFC 2131 recommends the ping "When allocating a new address, servers SHOULD check that the offered network address is not already in use; e.g., the server may probe the offered address with an ICMP Echo Request."
    – jonathanjo
    Mar 23, 2018 at 15:08
  • 1
    Thanks for the pointer - seems like I have to reread the RFC - "should" means "has to unless there's a good reason not to". ;-)
    – Zac67
    Mar 23, 2018 at 16:47
  • @Zac67 In that case the client would check the address and reject the offer which isn't really nice. I didn't get this point. which client you are referring to and check against what?
    – Deepak
    Mar 23, 2018 at 18:34
  • My observation after playing around with few real hosts (3 smartphones, a laptop and a desktop) and a wireless router. The router had configuration as - LAN interface IP address - 192.168.0.1/24 Starting address in DHCP pool - 192.168.0.100 I configured my laptop to have a static IP address as 192.168.0.102/24 Two of my smartphone were connected to the router wirelessly, and they had got the IP addresses 192.168.0.100/24 and 192.168.0.101/24 respectively. Now i decided to turn on my desktop, and once it booted up, checked its IP address, it had acquired 192.168.0.103/24.
    – Deepak
    Mar 23, 2018 at 18:43
  • I'm referring to the DHCP client - the client is obligated to check whether the address is unused (by ARP) and if the client rejects the offer and discovers again it might get the same offer again and run into a loop. The DHCP server might not even be able to check if the address is unused (when it's on another subnet and relayed to).
    – Zac67
    Mar 23, 2018 at 18:43
1

When these 8 hosts contact DHCP server for the IP address, will the DHCP server provide the IP address as 192.168.1.2/24?

"Probably" -- it depends on how that DHCP server implementation hands out addresses from its pools. This may be highest->lowest, lowest->highest, random, whatever.

If not, and it provides the IP address as 192.168.1.4, how does DHCP server know about the statically assigned IP addresses?

It doesn't! You can typically exclude individual addresses or ranges of addresses from a DHCP pool for precisely this purpose. Additionally, you can do "static DHCP" leases by having the server hand out a particular address from the pool when a specific MAC address is seen.

That being said, a DHCP server can be smart enough to check if an address is already in use prior to issuing the lease. It might simply ping the address, for example. I would not assume that behavior however without verifying it though.

Not the answer you're looking for? Browse other questions tagged or ask your own question.