Cisco DHCP configuration

A tutorial describing how to configure a Cisco router as a DHCP server, I’ll cover DHCP reservation and excluding of IP addresses as well. A DHCP server dynamically assigns IP addresses to hosts in a network, by creating DHCP reservations we can statically assign an IP address to a host based on its MAC address. IP address exclusion prevents conflicts among devices i certain hosts are manually assigned IP addresses. When configuring DHCP reservation it should be done differently for Windows DHCP clients and Linux DHCP clients because both of them make DHCP requests differently.

Configure a DHCP Pool on Cisco

On a Cisco router use the following commands to create a pool of IP addresses with a default gateway, DNS server and lease time.

The name of the pool is mynetwork1 which can be anything and it contains addresses from 192.168.0.1 to 192.168.0.254, the default gateway will be 192.168.0.1, DNS servers are 8.8.8.8 and 8.8.4.4 you can add more IP addresses by dividing them with spaces. Finally the lease time specifies how long the IP addresses will be valid before the client need to get them renewed. Here it is 4 days, 6 hours and 30 minutes.

DHCP IP address exclusion

Certain IP addresses like the IP address of the default gateway router and the DHCP server itself are assigned manually, since the DHCP pool covers the entire subnet containing the manually assigned IP address conflicts might occur. The following command excludes only one IP address

R1(config)#ip dhcp excluded-address 192.168.0.1

To exclude a range of IP addresses use the following command

R1(config)#ip dhcp excluded-address 192.168.0.1 192.168.0.5

Configure DHCP reservation

DHCP reservations are configured based on MAC addresses, an IP is statically assigned to a host with the specified MAC address. As said earlier DHCP reservations should be configured differently based on the DHCP client’s (the host TO which the IP will be assigned) Operating System.

DHCP reservation for Windows Clients

Follow these commands if you’re configuring a reservation for a windows host.

You need to create a separate pool for each DHCP reservation. The client-identifier is the MAC address of the host added with 01 at the beginning, so in this example the MAC address of the host is 080027d4e072 adding 01 at the beginning gives 01080027d4e072, divide four characters by a dot 0108.0027.d4e0.72

DHCP reservation for Linux Clients

The process is easy for statically assigning IP addresses to Linux hosts. Follow the commands below