How to Configure DHCP on Cisco IOS Devices




What is DHCP?

DHCP; which the acronym for Dynamic Host Configuration Protocol, is widely term which is used to automatically assign network parameters like IP address, mask, gateway, and DNS information to network clients. DHCP server services are traditionally deployed on network servers, it isn’t uncommon to see a DHCP server role configured on a router or switch in smaller environments.
The Dynamic Host Configuration Protocol (DHCP) is a standardized network protocol used on Internet Protocol (IP) networks for dynamically distributing network configuration parameters, such as IP addresses for interfaces and services.


How to Configure DHCP in Cisco IOS Devices?

  • Enable The DHCP Server Service
The first step is to enable the DHCP server service on the router.
BranchRouter# configure terminal
BranchRouter(config)# service dhcp

  • Define The DHCP Pool
Now we define the range of addresses the router should assign to client requests. The range is referred to as a pool.
BranchRouter(config)# ip dhcp pool MARKETING
BranchRouter(dhcp-config)# network [IP ADDRESS] [SUBNET MASK]
 

In the above example, the statement network [IP ADDRESS] [SUBNET MASK] directs the router to issue IP addresses to clients using range X.X.X.1-X.X.X.254. This defines the whole subnet for the client scope. This is not a good practice since we need other devices on the segment (like the router’s gateway IP address).

We’ll add a list of addresses to exclude in just a minute. Before we do that we need to define the additional DHCP parameters we want to define for the DHCP leases.
  • DHCP Parameters.
Clients need information like a gateway address, primary and secondary DNS servers, domain name to use, and DHCP lease period.
BranchRouter(dhcp-config)# default-router
[IP ADDRESS]
BranchRouter(dhcp-config)# dns-server X.X.X.50 X.X.X.51 BranchRouter(dhcp-config)# domain-name [WEBSITE].com


There are numerous DHCP options you can assign, but here are a few of the most common:
  1. Domain-name – Defines the domain name the client should use
  2. Dns-server address [address2] – Lists the DNS servers (in order of preference) the client should use
  3. Default-router – Defines the client’s gateway
  4. Lease {days [hours [minutes]] | infinite} – Defines the lease duration (default is 24 hours)
  • Define The Exclude List
The last step is to define the client exclude list to the DHCP scope. In this case we exclude the first 99 IP addresses for use by the local router interface and other statically-assigned devices like servers. This effectively makes the client range

 X.X.X.100 - X.X.X.254

BranchRouter(config)# ip dhcp excluded-address X.X.X.1 X.X.X.99 

After you have enabled the DHCP service, defined the DHCP lease pool, DHCP parameters, and a DHCP exclude list, the DHCP service will be active and responding to client requests. Pretty simple.

  • Viewing Client Leases
After the DHCP server configuration is in place on the local router or layer 3 switch, you can use the show ip dhcp binding command to view the active DHCP client leases issued.
 

Router#show ip dhcp binding.






No comments:

Post a Comment