ip dhcp pool
IP DHCP POOL
The ip dhcp pool command allows us to create a DHCP pool on a Cisco IOS device. This command is available on most Layer 3 devices running Cisco IOS and is used to configure the DHCP server service on these devices.
The format of the command is as follows:
ip dhcp pool <pool-name>
DHCP pool configuration parameters
Some of the commonly used parameters used when configuring a DHCP pool on a Cisco IOS device are as follows:
- network (defined by a network address and subnet mask - this is the IP subnet for which the DHCP pool is being created.)
- default-router (the IP address of the default gateway for the subnet)
- dns-server (a list of dns server addresses for DHCP clients to use - a total of 8 server addresses are supported in each pool.)
- domain-name (the DNS suffix to assign to DHCP clients)
- lease (the length of time for which the DHCP lease is valid - specified as "Days Hours Minutes")
- option (specific DHCP options)
In the following example, we create a dhcp pool for the subnet 192.168.0.0/24:
A DHCP pool was created with the following details :
- The name of the pool is set to Vlan10-computers. (This helps us identify the purpose of this pool.)
- The pool was created to assign client IP addresses from the subnet 192.168.0.0 /24.
- Clients receiving their IP configuration from this pool will be assigned a default gateway address of 192.168.0.1.
- Clients receiving their IP configuration from this pool will be assigned two DNS servers: 8.8.8.8 and 1.1.1.1.
- Clients receiving their IP configuration from this pool will be assigned the domain suffix home.lab.
- IP addresses leased out from this pool will be leased out for a period of 7 days, 0 hours and 0 minutes.
Caveat: The router above will assign IP addresses from this pool (when it receives a DHCP Discover message), as long as one of the following two conditions are met:
- The router receives a DHCP Discover message on an interface that is configured with an IP address from the subnet 192.168.0.0/24; or,
- The router receives a DHCP Discover message that includes a Gateway IP address value that falls within the subnet 192.168.0.0/24. (This would happen if the DHCP Discover message is forwarded by a DHCP Relay Agent.)
Most often, when we find that a Cisco IOS device is not assigning IP addresses from one of the pools configured on it, potential reasons would be:
- The dhcp service has been disabled (using the command no service dhcp); or,
- There is no Layer 3 interface configured with an IP address that belongs to the subnet for which the pool has been configured.
Are we able to exclude one or more IP addresses from a DHCP pool? Yes, we are. This can be done using the command ip dhcp excluded-address.
DHCP, DNS and NAT are covered extensively in the following interactive course: Course 6 - IP Services. The course features visual, animated explanations and hands-on interactive labs.
Want to test your networking skills with hands-on configuration and troubleshooting questions? Try out the Workshops section of this website here: Workshops (Login required).
Read how to use the device simulators on this website here: Workshops - General Instructions