A Cisco router running Cisco IOS software can be configured to act as a DHCPv4 server. The Cisco IOS DHCPv4 server assigns and manages IPv4 addresses from specified address pools within the router to DHCPv4 clients. The topology shown in Figure 1 is used to illustrate this functionality.
Step 1. Excluding IPv4 Addresses
The router functioning as the DHCPv4 server assigns all IPv4 addresses in a DHCPv4 address pool unless configured to exclude specific addresses. Typically, some IPv4 addresses in a pool are assigned to network devices that require static address assignments. Therefore, these IPv4 addresses should not be assigned to other devices. To exclude specific addresses, use the ip dhcp excluded-address command as shown in Figure 2.
A single address or a range of addresses can be excluded by specifying the low-address and high-address of the range. Excluded addresses should include the addresses assigned to routers, servers, printers, and other devices that have been manually configured.
Step 2. Configuring a DHCPv4 Pool
Configuring a DHCPv4 server involves defining a pool of addresses to assign. As shown in Figure 3, the ip dhcp pool pool-name command creates a pool with the specified name and puts the router in DHCPv4 configuration mode, which is identified by this prompt Router(dhcp-config)#.
Step 3. Configuring Specific Tasks
Figure 4 lists the tasks to complete the DHCPv4 pool configuration. Some of these are optional, while others must be configured.
The address pool and default gateway router must be configured. Use the network statement to define the range of available addresses.
Use the default-router command to define the default gateway router. Typically, the gateway is the LAN interface of the router closest to the client devices. One gateway is required, but you can list up to eight addresses if there are multiple gateways.
Other DHCPv4 pool commands are optional. For example, the IPv4 address of the DNS server that is available to a DHCPv4 client is configured using the dns-server command. The domain-name domain command is used to define the domain name. The duration of the DHCPv4 lease can be changed using the lease command. The default lease value is one day. The netbios-name-server command is used to define the NetBIOS WINS server.
A sample configuration with basic DHCPv4 parameters configured on router R1, a DHCPv4 server for the 192.168.10.0/24 LAN is shown in Figure 5 using the example topology from Figure 1.
The DHCPv4 service is enabled, by default, on versions of Cisco IOS software that support it. To disable the service, use the no service dhcp global configuration mode command. Use the service dhcp global configuration mode command to re-enable the DHCPv4 server process. Enabling the service has no effect if the parameters are not configured.
Using the Syntax Checker activity in Figure 6 to configure similar DHCPv4 parameters on R1 for the 192.168.11.0/24 LAN.