1

In a router , you can create and configure multiple DHCP pools each one with its own default route and dns server . And because the DHCP pool configuration is not specific to an interface in a router, I want to understand from which pool a device will pick its IP address . Is it random ? Or is it based on the address used by device to connect to the DHCP server ?

8
  • The pool is tied to the interface - by the network configured on the interface.
    – Ron Maupin
    Commented Oct 12, 2020 at 17:08
  • So its based on the IP address configured on the interfaces ? Even tho there is no actual command on enabling a specific pool on a certain interface ?
    – Strategist
    Commented Oct 12, 2020 at 17:11
  • The router knows which interface where the request came in, and it knows the network configured on the interface because the assigned address can be masked with the network mask assigned to the interface (how it ends up as a directly connected network in the routing table). If there is a DHCP configuration for a range in that network, it is used, otherwise the request is ignored.
    – Ron Maupin
    Commented Oct 12, 2020 at 17:17
  • So it's purely based on the IP address of the interface that recieved the DHCP request , and then it matchs the IP address of the interface with the network of the DHCP pool ?
    – Strategist
    Commented Oct 12, 2020 at 17:30
  • It matches the network of the incoming interface with the DHCP pool.
    – Ron Maupin
    Commented Oct 12, 2020 at 17:54

4 Answers 4

1

On a DHCP server (which may be integrated in a router), you can configure multiple scopes with one or more address pools each. Each scope matches a local interface subnet, or it is used with a relay which signals the source subnet via option 82. Sometimes policies are used.

DHCP options like DNS server and routers are usually configured on a scope (or globally), not on an address pool (hence server options and scope options).

Scope matching is unambiguous for a server. When there are multiple address pools in a scope, the server selects from any one of them at will.

1

I believe pool is chosen by the incoming interface of the router or DHCP relay. Router match pool which addresses are matching incoming interface network/netmask. Several pools on a router(R1) may not be tied to R1 interfaces because DHCP packet can be received through router/DHCP relay(R2). In that case relayed packet will also have a field of incoming interface of R2 and R1 will do same choosing.

1
  • 1
    There is a specific DHCP option for DHCP relay that will tell the DHCP server for which network it is requesting.
    – Ron Maupin
    Commented Oct 12, 2020 at 17:27
0

You've actually complicated matters somewhat by making a few incorrect statements so I'll pick through your question on an individual basis.

In a router , you can create and configure multiple DHCP pools each one with its own default route

  • DHCP pools will not have a default 'route'. The DHCP server will communicate a default 'gateway' to clients which I believe is what you meant. That default gateway can be the router itself (usually the IP interface that the router has within the subnet that the pool is intended for) or the gateway provided could be another IP address or even another device. For example, a Windows Server acting as a DHCP server may advise clients that the default gateway is a router IP address.

and dns server.

  • DHCP pools do not have their own DNS server. DHCP and DNS are two different services. A DHCP pool will generally advise clients what DNS server to use, though. That may be the same device providing the DHCP pool (e.g. a router) in which case that router is acting as a DNS proxy as well as a DHCP server. Alternatively, clients could be advised to use a different DNS server - this could even be an external DNS server e.g. 8.8.8.8 at Google.

And because the DHCP pool configuration is not specific to an interface in a router

  • Yes it is. Generally speaking, a single device (e.g. a router) will provide one DHCP pool per subnet and in turn the router will have one IP address (interface) within that subnet.

I want to understand from which pool a device will pick its IP address

  • The 'correct' configuration would normally be for a router to have one DHCP pool per subnet which in turn would have a VLAN assignment and therefore client devices will obtain an IP address from the DHCP pool assigned to the VLAN that they are connected to.

The only times that you are likely to see multiple DHCP pools within the same subnet (sequentially, not overlapping) is where resiliency for DHCP assignment is desired.

For example, you could have two different Windows Server DHCP servers providing IP addresses on the same subnet, one providing 192.168.1.100-150 and the other providing 192.168.151-200 just as an example. That way clients can still obtain an address if one is offline.

- Is it random ? No. You'll find networking isn't a random science.

- Or is it based on the address used by device to connect to the DHCP server ? No, because you've created a chicken-or-the-egg paradox here. If the DHCP assignment was based on the device address, how would the device have an address if it hadn't talked to the DHCP server yet? DHCP pool allocation is based on these things:

  • Client device communicates on a VLAN.
  • DHCP pool is available on the SUBNET associated with that VLAN.
  • DHCP scope/pool has been created for that SUBNET on the DHCP server.
  • DHCP server has an IP interface on that SUBNET that is able to communicate via a physical interface to the VLAN of the client device in question.
4
  • 3
    When the questioner says "each [pool] with its own default route and dns server", they surely mean "own default route and dns server information". It's splitting hairs to say that the pool doesn't specifiy a default route: it's surely 0.0.0.0/0 => default gateway, and in any case DHCP certainly can specify arbitrary routes, with Option 121. NB: there is lots of random in networking, and in multiple DHCP server networks, there are on-purpose race conditions which use it.
    – jonathanjo
    Commented Oct 12, 2020 at 22:25
  • We're talking about network configuration. Nothing random there. And no, the DHCP server is not specifying a default route to the gateway in this instance, because routing happens at Layer 3 and the client - DHCP server - and gateway in this scenario would all be communicating at Layer 2. No option codes in sight here either. More reading required for you I think. Commented Oct 12, 2020 at 22:26
  • 2
    I have removed an unrelated link from the answer promoting services.
    – Zac67
    Commented Oct 13, 2020 at 2:55
  • 1
    Clearly when I said "each pool with its own default route and DNS server" I meant the default gateway and DNS address provided by DHCP. But when it came down to the important question : "Generally speaking, a single device will provide one DHCP pool per subnet and in turn, the router will have one IP address within that subnet." You answered a different question and the same when you talked about VLAN. Those are general circumstances and in a network there won't be always a router interface related to the DHCP pool. Please correct me if Im wrong.
    – Strategist
    Commented Oct 13, 2020 at 6:10
-1

While configuring DHCP pool " default gateway information is configured for example

Switch(config) ip DHCP pool vlan30

Switch(config)# network 192.168.10.0 255.255.255.0

Switch(config)#ip default gateway 192.168.10.1

This last command tell the device to allocate ips from this DHCP scope for pc using default gateway 192.168.10.1

2
  • This is plain wrong. At the stade where the PC request a DHCP address it generally doesn't have a default gateway. The gateway is usually provided by the DHCP server as part of the options coming with the DHCP lease.
    – JFL
    Commented Jan 15 at 16:21
  • My comment related to dhcp server, not on behalf of clients Commented Jan 21 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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