Overview

Configure the Cisco router as a DHCP server; configure a DHCP relay agent and manual binding to assign a specific IP address.

Network Diagram

Figure: DHCP server Configuration example network diagrram
Figure: DHCP server Configuration example network diagrram

Configuration Conditions

  • R1 acts as the DHCP server; HOST1, HOST2, and R2 E0/0 act as DHCP clients; HOST1 and HOST2 use Cisco routers.
  • Assign 192.168.13.101 to HOST1 and 192.168.12.2 to R2 E0/0.
    HOST1 MAC address : cc-03-1d-8c-00-00
    R2 MAC address : cc-01-1d-8c-00-00
  • The IP address of the DNS server is assigned as 1.1.1.1 and the domain name as n-sutdy.com. However, these configurations are performed only once.

Configuration and Verification

Step1:DHCP Relay Agent Configuration

HOST1 and HOST2 are on separate subnets from R1, which is the DHCP server, so R3 configures the DHCP relay agent to forward DHCP broadcasts received on Ethernet0/1 to R1.

R3 DHCP Relay Agent Configuration

interface Ethernet0/1
 ip helper-address 192.168.13.1

Step2:DHCP Pool Configuration

Configure a DHCP pool for the subnet 192.168.3.0/24 on R1. No DNS servers and domain names are configured for this DHCP pool; the DNS servers and domain names should be inherited from the aggregated pool. Also, configure HOST2 as a DHCP client.

R1 DHCP pool configuration

ip dhcp pool 192.168.3.0
   network 192.168.3.0 255.255.255.0
   default-router 192.168.3.3

HOST2 DHCP client configuration

interface Ethernet0/0
 ip address dhcp

Step3:Manual Binding Configuration

Fixed assignment of 192.168.3.101 to HOST1. To do this, R1 is configured with a pool for manual binding to look at the MAC address of HOST1 and assign an IP address. Similarly, configure a pool for manual binding on R1 for a fixed assignment of 192.168.12.2 to R2.

R1 Manual Binding Pools

ip dhcp pool HOST1
   host 192.168.3.101 255.255.255.0
   client-identifier 01cc.031d.8c00.00
   default-router 192.168.3.3
!
ip dhcp pool R2
   host 192.168.12.2 255.255.255.0
   client-identifier 01cc.011d.8c00.00

HOST1 and R2 are then configured as DHCP clients. Use the MAC address of the interface as the client ID.

HOST1 DHCP Client

interface Ethernet0/0
 ip address dhcp client-id Ethernet0/0

R2 DHCP Client

interface Ethernet0/0
 ip address dhcp client-id Ethernet0/0

Step4:DNS Server and Domain name Pool Configuration

To make the pool created so far inherit the DNS server and domain name information, create a pool “DNS_DOMAIN” that specifies the DNS server and domain name. In this pool, the address range “192.168.0.0/16” is the aggregate address range of all the previously configured DHCP pool address ranges.

R1 DNS Server and Domain name Pool Configuration

ip dhcp pool DNS_DOMAIN
   network 192.168.0.0 255.255.0.0
   domain-name n-study.com
   dns-server 1.1.1.1

Step5:DHCP Verification

Verify the DHCP configuration up to Step 4. On the DHCP server R1, use the show ip dhcp pool/show ip dhcp bindings command to verify the DHCP pool and the IP addresses assigned to DHCP clients.

R1 show ip dhcp pool/show ip dhcp bindings

R1#show ip dhcp pool
 
Pool HOST1 :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0
 Total addresses                : 1
 Leased addresses               : 1
 Pending event                  : none
 0 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 192.168.3.101        192.168.3.101    - 192.168.3.101     1
 
Pool 192.168.3.0 :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0
 Total addresses                : 254
 Leased addresses               : 1
 Pending event                  : none
 1 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 192.168.3.5          192.168.3.1      - 192.168.3.254     1
 
Pool DNS_DOMAIN :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0
 Total addresses                : 65534
 Leased addresses               : 0
 Pending event                  : none
 1 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 192.168.0.3          192.168.0.1      - 192.168.255.254   0
 
Pool R2 :
 Utilization mark (high/low)    : 100 / 0
 Subnet size (first/next)       : 0 / 0
 Total addresses                : 1
 Leased addresses               : 1
 Pending event                  : none
 0 subnet is currently in the pool :
 Current index        IP address range                    Leased addresses
 192.168.12.2         192.168.12.2     - 192.168.12.2      1
R1#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address          Client-ID/              Lease expiration        Type
                    Hardware address/
                    User name
192.168.3.4         0063.6973.636f.2d63.    Mar 02 2002 01:47 AM    Automatic
                    6330.342e.3164.3863.
                    2e30.3030.302d.4574.
                    302f.30
192.168.3.101       01cc.031d.8c00.00       Infinite                Manual
192.168.12.2        01cc.011d.8c00.00       Infinite                Manual

On DHCP clients HOST1, HOST2, and R2, use show ip interface brief/show dhcp server to verify the configuration distributed with DHCP.

R2 show ip interface brief/show dhcp server

R2#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.12.2    YES DHCP   up                    up
-- omitted --
R2#show dhcp server
   DHCP server: ANY (255.255.255.255)
    Leases:   6
    Offers:   6      Requests: 6     Acks : 6     Naks: 0
    Declines: 0      Releases: 15     Query: 0     Bad: 0
    DNS0:   1.1.1.1,   DNS1:  0.0.0.0
    Subnet: 255.255.255.0   DNS Domain: n-study.com

HOST1 show ip interface brief/show dhcp server

HOST1#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.3.101   YES DHCP   up                    up
-- omitted --
HOST1#show dhcp server
   DHCP server: ANY (255.255.255.255)
    Leases:   2
    Offers:   2      Requests: 2     Acks : 2     Naks: 0
    Declines: 0      Releases: 3     Query: 0     Bad: 0
    DNS0:   1.1.1.1,   DNS1:  0.0.0.0
    Subnet: 255.255.255.0   DNS Domain: n-study.com

HOST2 show ip interface brief/show dhcp server

HOST2#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.3.4     YES DHCP   up                    up
-- omitted --
HOST2#show dhcp server
   DHCP server: ANY (255.255.255.255)
    Leases:   2
    Offers:   2      Requests: 2     Acks : 2     Naks: 0
    Declines: 0      Releases: 3     Query: 0     Bad: 0
    DNS0:   1.1.1.1,   DNS1:  0.0.0.0
    Subnet: 255.255.255.0   DNS Domain: n-study.com

You can see that the IP address is correctly distributed from R1, the DHCP server, to the DHCP clients.