DHCP

DHCP Server

Sections: 

Overview: 

  • After getting an overview of DHCP in the Overview section, let's demonstrate configuring a Layer 3 switch as a DHCP server to serve clients in different VLANs
  • This form of DHCP implementation is useful in cases where there are no dedicated DHCP servers in the environment or for smaller environments 
  • The command structure is similar for implementing a DHCP server on either a router or a layer 3 switch 

Lab Topology

Scenario: 

  • In this lab scenario, lets demonstrate configuring a DHCP server on the Layer 3 core switch serving as the gateway for all VLANs in the network
  • Trunk links, VLAN assignments, and SVIs have already been configured in the topology
  • I will define a range of excluded addresses for each scope as best practice for the use static IP devices in the future
  • I will define four DHCP scopes, one for each VLAN 
  • I will assign additional parameters per DHCP scope configuration including options for default gateway 
  • I will configure an additional scope for DHCP client reservation use as it's required on Cisco devices
  • Let's analyze a packet capture on the Core switch links to analyze the D.O.R.A process messages between client and server

Configuration

HQ-Core-SW1 

Define the excluded IP address ranges for use of future static IP devices and follow a consistent address scope for all VLANs as best practice. The excluded address ranges will apply to all DHCP scopes configured

  • VLAN10 - 192.168.10.1 - 192.168.10.99, x.x.x.201 - x.x.x.254
  • VLAN20 - 192.168.20.1 - 192.168.20.99, x.x.x.201 - x.x.x.254
  • VLAN60 - 192.168.60.1 - 192.168.60.99, x.x.x.201 - x.x.x.254
  • VLAN80 - 192.168.80.1 - 192.168.80.99, x.x.x.201 - x.x.x.254

Create a DHCP pool for the Engineering VLAN10 and assign the network, default gateway, DNS server, and lease time.

Create a DHCP pool for the Engineering and Finance VLANs and assign the network, default gateway, DNS server, and lease time.

Create a DHCP pool for the Servers VLAN and assign the network, default gateway, DNS server, and lease time.

Note: When configuring a DHCP address reservation for a specific client based on MAC address, you will need to create a separate DHCP scope for each reserved client and specify the reserved IP address assignment and the client-identifier or MAC address. Cisco appends a '01' at the start of the client MAC address or client-identifier to denote Ethernet outlined in RFC 2131.  The reserved client IP, in this case 192.168.80.100, will have to be within the DHCP scope of any pool already configured and also not within the excluded address ranges configured in the first step. Clients with a DHCP address reservation rely on the DHCP server to obtain their reserved IP address. Another way to set an IP on a fixed static IP device is to manually configure the static IP and its parameters so those clients don't have to rely on the DHCP server. This manual fixed IP would have to be included in the DHCP excluded address ranges so the DHCP server does not hand out those IPs to DHCP clients.

Note: The DHCP pool for each reserved client will inherit the DHCP parameters and options from the already configured pool that is within their IP address scope from the network statements.

Verify DHCP configuration thus far by issuing a show running-config command. Five configured pools in addition to the excluded address ranges that will be used by each pool when it comes to handing out IP addresses.

Validation

Enabling Client DHCP and Validating DHCP Database

Scenario: 

  • In this scenario, we will enable DHCP on all PCs in each VLAN and examine the DHCP binding table of the Core switch to analyze the active leases
  • We will then test PC connectivity by testing gateway and Internet connectivity

VLAN 10 / Engineering

VLAN 20 / Finance

VLAN 60 / MGMT

VLAN 80 / Servers

HQ-Core-SW1

Summary database of active leases.

Detailed view of pool statistics and counters.

Detailed view of DHCP server counters for packet type categories.

The 'clear ip dhcp binding' command clears the DHCP database of the Cisco DHCP server.

DHCP Packet Captures

Scenario: 

  • In this lab scenario, lets analyze packet captures on the core switch interfaces to view the DHCP D.O.R.A process messages between the VLAN clients and the core switch DHCP server

Discover Packet

Offer Packet

Request Packet

Acknowledgment Packet