Routing & Switching

How to configure DHCP on a Cisco router

To enable DHCP on a Cisco router using the topology below we must complete the following tasks:

  • Configure R1 as our DHCP server for both blue and red networks.
    Blue Network 10.10.10.0/24 – GW: 10.10.10.1
    Red Network 20.20.20.0/24 – GW: 20.20.20.1
  • Start DHCP pool at x.x.100-254
  • 10 day lease time
cisco config dhcp
cisco config dhcp

R1 Configuration:

Router(config)#ip ?    
Global IP configuration subcommands:
  dhcp                    Configure DHCP server and relay parameters
Router(config)#ip dhcp ?
  pool                       Configure DHCP address pools
Router(config)#ip dhcp pool ?
  LINE  Pool name
!
Router(config)#ip dhcp pool Blue
Router(dhcp-config)#network 10.10.10.0 255.255.255.0
Router(dhcp-config)#default-router 10.10.10.1
!
!
Router(config)#ip dhcp pool Red
Router(dhcp-config)#network 20.20.20.0 255.255.255.0
Router(dhcp-config)#default-router 20.20.20.1
!
!
Router(config)#ip dhcp excluded-address 10.10.10.1 10.10.10.99
Router(config)#ip dhcp excluded-address 20.20.20.1 20.20.20.99

From our virtual PC-1 and PC-2

ip dhcp [OPTION]
  Attempt to obtain IPv4 address, mask, gateway and DNS via DHCP
  OPTION:
    -d         Show DHCP packet decode
    -r         Renew DHCP lease
    -x         Release DHCP lease
!
!
PC-1> ip dhcp -r
DDORA IP 10.10.10.100/24 GW 10.10.10.1
!
PC-2> ip dhcp -r
DDORA IP 20.20.20.100/24 GW 20.20.20.1

Verification:

Router#show ip dhcp binding 
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
10.10.10.101        0100.5079.6668.00       Oct 01 2018 07:09 AM    Automatic
20.20.20.101        0100.5079.6668.01       Oct 01 2018 07:09 AM    Automatic
!
!
!!DANGER!! Running debugs can crash lower end routers
!
Router#debug ip dhcp server events 
!
!
*Sep 21 07:01:24.729: DHCPD: Sending notification of DISCOVER:
*Sep 21 07:01:24.729:   DHCPD: htype 1 chaddr 0050.7966.6800
*Sep 21 07:01:24.730:   DHCPD: remote id 020a00000a0a0a010000000a
*Sep 21 07:01:24.730:   DHCPD: circuit id 00000000
*Sep 21 07:01:24.730: DHCPD: Seeing if there is an internally specified pool class:
*Sep 21 07:01:24.730:   DHCPD: htype 1 chaddr 0050.7966.6800
*Sep 21 07:01:24.731:   DHCPD: remote id 020a00000a0a0a010000000a
*Sep 21 07:01:24.731:   DHCPD: circuit id 00000000
*Sep 21 07:01:24.733: DHCPD: Allocated binding D14A868
*Sep 21 07:01:24.733: DHCPD: Adding binding to radix tree (10.10.10.100)
Router#
*Sep 21 07:01:24.734: DHCPD: Adding binding to hash tree
*Sep 21 07:01:24.734: DHCPD: assigned IP address 10.10.10.100 to client 0100.5079.6668.00.
*Sep 21 07:01:25.789: DHCPD: Sending notification of DISCOVER:
*Sep 21 07:01:25.790:   DHCPD: htype 1 chaddr 0050.7966.6800
*Sep 21 07:01:25.790:   DHCPD: remote id 020a00000a0a0a010000000a
*Sep 21 07:01:25.790:   DHCPD: circuit id 00000000
*Sep 21 07:01:25.790: DHCPD: Seeing if there is an internally specified pool class:
*Sep 21 07:01:25.790:   DHCPD: htype 1 chaddr 0050.7966.6800
*Sep 21 07:01:25.791:   DHCPD: remote id 020a00000a0a0a010000000a
*Sep 21 07:01:25.791:   DHCPD: circuit id 00000000
*Sep 21 07:01:25.791: DHCPD: Found previous server binding
Router#
*Sep 21 07:01:26.732: DHCPD: Sending notification of DISCOVER:
*Sep 21 07:01:26.732:   DHCPD: htype 1 chaddr 0050.7966.6800
*Sep 21 07:01:26.732:   DHCPD: remote id 020a00000a0a0a010000000a
*Sep 21 07:01:26.733:   DHCPD: circuit id 00000000
*Sep 21 07:01:26.733: DHCPD: Seeing if there is an internally specified pool class:
*Sep 21 07:01:26.733:   DHCPD: htype 1 chaddr 0050.7966.6800
*Sep 21 07:01:26.733:   DHCPD: remote id 020a00000a0a0a010000000a
*Sep 21 07:01:26.734:   DHCPD: circuit id 00000000
Router#
*Sep 21 07:01:28.714: DHCPD: Sending notification of ASSIGNMENT:
*Sep 21 07:01:28.715:  DHCPD: address 10.10.10.100 mask 255.255.255.0
*Sep 21 07:01:28.715:   DHCPD: htype 1 chaddr 0050.7966.6800
*Sep 21 07:01:28.715:   DHCPD: lease time remaining (secs) = 86400
!

Download DHCP GNS3 Lab