DHCP Configuration Example

In the following example client-class class1 will be configured with a default router 3.3.3.3 and a DNS server 4.4.4.4. When we assign client-class class1 to client 00:11:22:33:44:55 using the hardware-address command within DHCP pool pool1, the pool settings for default router (1.1.1.1) will be overwritten by the client-class class1 settings for this client and any client that should receive a dynamic request with DHCP option 77 specifying client-class class1. The DNS server setting will be neither the pool1 setting nor the class1 setting. It will be manually set in the host configuration mode for this client to IP address 5.5.5.5. If it were not manually set, it would take the setting specified in class1.

pool1 settings also include:

These settings will apply to any client configured within pool1 that is not overwritten by either a client class setting or a received option setting.

The example first configures a local pool pool1 to either automatically or allow the manual setting of IP addresses from the 10.60.0.0 subnet. IP addresses 10.60.0.10 - 30 are excluded from the local pool1. These addresses cannot be automatically or manually assigned to clients in this pool. DHCP pool configuration is then entered for pool1 setting the default router to 1.1.1.1 and the DNS server to 2.2.2.2. When client classes are not applied, these values will be configured along with all the other values listed for this pool.

Client-class class1 is configured as specified above. The client-class class1 is applied to client 00:11:22:33:44:55. Entering host configuration mode for this client, the DNS server is set to IP address 5.5.5.5. This setting will override the class1 DNS server setting for this client. The host IP address for this client is manually set to 10.60.0.1 from the local pool. If the client IP address were not manually set, the client IP address would have been automatically set from the local pool of addresses configured for pool1.

System(rw-config)->ip local pool pool1 10.60.1.0 255.255.255.0
System(rw-config-ip-local-pool)->exclude 10.60.1.10 20
System(rw-config-ip-local-pool)->exit
System(rw-config)->ip dhcp pool pool1
System(rw-config-dhcp-pool)->domain-name MyCompany.com
System(rw-config-dhcp-pool)->bootfile dhcpboot
System(rw-config-dhcp-pool)->option 72 ip 10.70.0.10 10.70.0.11 10.70.0.12
System(rw-config-dhcp-pool)->next-server 10.70.0.12
System(rw-config-dhcp-pool)->lease 100
System(rw-config-dhcp-pool)->default-router 1.1.1.1
System(rw-config-dhcp-pool)->dns-server 2.2.2.2
System(rw-config-dhcp-pool)->client-class class1
System(rw-config-dhcp-class)->default-router 3.3.3.3
System(rw-config-dhcp-class)->dns-server 4.4.4.4
System(rw-config-dhcp-class)->exit
System(rw-config-dhcp-pool)->hardware-address 00:11:22:33:44:55 client-class          class1
System(rw-config-dhcp-host)->dns-server 5.5.5.5
System(rw-config-dhcp-host)->host 10.60.0.1
System(rw-config-dhcp-host)->exit
System(rw-config-dhcp-pool)->exit
System(rw-config)->