DHCPv4 Server & DHCPv4 Client Configuration on Cisco Router - Netizzan

DHCPv4 Server & DHCPv4 Client Configuration on Cisco Router

Dynamic Host Configuration Protocol for IPv4 (DHCPv4) streamlines network administration by automatically assigning IP addresses and providing network configuration information to devices within a network.

In this blog post, we’ll explore how to configure a DHCPv4 server on R1 and set up R2 as a DHCPv4 client. We’ll also verify the DHCPv4 settings and examine DHCPv4 server statistics.

Network topology

The network topology we will be making use of in this post is shown below. As you can see, it consists of two routers. Router 1 and Router 2. We will configure Router 1 as the DHCP server and Router 2 as the DHCPv4 client.

Network Topology for DHCPv4 configuration

DHCPv4 Server and Client Configuration Steps

Here are the steps to configure DHCPv4 on the network above:

Step 1: Configure Router 1 as DHCPv4 Server

As stated in the network topology, we will configure Router 1 as a DHCPv4 server.

Firstly, configure the interface of the router.

R1(config)#interface ethernet0/0
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R1(config-if)#no shutdown

Then configure Router1 as the DHCPv4 server.

R1(config)#ip dhcp excluded-address 192.168.12.1 192.168.12.10 
R1(config)#ip dhcp pool LAN
R1(dhcp-config)#network 192.168.12.0 /24
R1(dhcp-config)#default-router 192.168.12.1
R1(dhcp-config)#dns-server 1.1.1.1 1.0.0.1
R1(dhcp-config)#domain-name cisco.lab
R1(dhcp-config)#lease 1

Here is a brief explanation of the above commands;

Line 1: <– Reserved the IP address pool from 192.168.12.1 to 192.168.12.10

Line 2: <– Create a DHCP pool

Line 3: <– Network number and mask

Line 4: <– Default Routers

Line 5: <– DNS Servers

Line 6: <– Domain name

Line 7: <– Address lease time

Step 2: Configure R2 as a DHCPv4 Client

R2(config)#interface ethernet0/0
R2(config-if)#ip address dhcp
R2(config-if)#no shutdown

Step 3: Confirm the Configuration (Show commands)

 

Checking if Router2 Received an IP address from the server;

R2#show ip interface brief 
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.12.11   YES DHCP   up                    up      
Ethernet0/1                unassigned      YES unset  administratively down down    
Ethernet0/2                unassigned      YES unset  administratively down down    
Ethernet0/3                unassigned      YES unset  administratively down down

More Details about Router2’s ethernet0/0 interface

R2#show ip interface ethernet0/0
Ethernet0/0 is up, line protocol is up
  Internet address is 192.168.12.11/24   <-- ethernet0/0 has been assigned the IP address 192.168.12.11/24 via DHCP server.
  Broadcast address is 255.255.255.255
  Address determined by DHCP
  MTU is 1500 bytes
  Helper address is not set
  Directed broadcast forwarding is disabled
  Outgoing access list is not set
  Inbound  access list is not set
  Proxy ARP is enabled
  Local Proxy ARP is disabled
  Security level is default
  Split horizon is enabled
  ICMP redirects are always sent
  ICMP unreachables are always sent
  ICMP mask replies are never sent
  IP fast switching is enabled
  IP fast switching on the same interface is disabled
  IP Flow switching is disabled
  IP CEF switching is enabled
  IP CEF switching turbo vector
  IP multicast fast switching is enabled
  IP multicast distributed fast switching is disabled
  IP route-cache flags are Fast, CEF
  Router Discovery is disabled
  IP output packet accounting is disabled
  IP access violation accounting is disabled
  TCP/IP header compression is disabled
  RTP/IP header compression is disabled
  Policy routing is disabled
  Network address translation is disabled
  BGP Policy Mapping is disabled
  Input features: MCI Check
  IPv4 WCCP Redirect outbound is disabled
  IPv4 WCCP Redirect inbound is disabled
  IPv4 WCCP Redirect exclude is disabled

Checking the gateway and default route

R2#show ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is 192.168.12.1 to network 0.0.0.0

S*    0.0.0.0/0 [254/0] via 192.168.12.1 			   <-- Default Route and Next hop gateway
      192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.12.0/24 is directly connected, Ethernet0/0
L        192.168.12.11/32 is directly connected, Ethernet0/0

 

Checking what is Primary DNS, Secondary DNS and Domain name

R2#show ip dns view

DNS View default parameters:
Logging is off
DNS Resolver settings:
  Domain lookup is enabled
  Default domain name: cisco.lab 	<-- Domain name
  Domain search list:
  Lookup timeout: 3 seconds
  Lookup retries: 2
  Domain name-servers:
    1.1.1.1				<-- Primary DNS
    1.0.0.1				<-- Secondary DNS
DNS Server settings:
  Forwarding of queries is enabled
  Forwarder timeout: 3 seconds
  Forwarder retries: 2
  Forwarder addresses:

On Router 1

Check on R1 the DHCP IP binding 

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.12.11       0063.6973.636f.2d61.    Dec 14 2023 08:56 AM    Automatic
                    6162.622e.6363.3030.
                    2e32.6130.302d.4574.
                    302f.30

Check on R1 the DHCP Statistics 

R1#show ip dhcp server statistics

Memory usage         32643
Address pools        1
Database agents      0
Automatic bindings   1
Manual bindings      0
Expired bindings     0
Malformed messages   0
Secure arp entries   0

Message              Received
BOOTREQUEST          0
DHCPDISCOVER         1
DHCPREQUEST          1
DHCPDECLINE          0
DHCPRELEASE          0
DHCPINFORM           0

Message              Sent
BOOTREPLY            0
DHCPOFFER            1
DHCPACK              1
DHCPNAK              0

Related:

How to Configure DHCP on Layer 2 Switch in Packet Tracer

How to Configure DHCP on Layer 3 Switch In Packet Tracer

 

Reference: https://github.com/misterkrittin/CCNA-Labs

Related content;

How to Configure DHCP Server For Multiple VLANS in Packet Tracer

How to Configure DHCP Snooping In Cisco Packet Tracer

How to Configure DHCP on Layer 2 Switch in Packet Tracer

How to Configure DHCP Relay Agent on Layer 3 Switch

How to Configure DHCP on Layer 3 Switch In Packet Tracer

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top