🌐 DHCP (Dynamic Host Configuration Protocol)

 

📌 Methods of Assigning IP Address :-

In a network, IP addresses can be assigned to devices using two different methods, where one method involves manual configuration and the other method allows automatic assignment without human intervention, making network management either complex or simple depending on the method used.

 

1️⃣ Static Method (Manual) :

In the static method, the network administrator manually assigns an IP address, subnet mask, gateway, and other settings to each device, which provides full control over addressing but becomes difficult to manage in large networks.

 

2️⃣ Dynamic Method (Automatic → DHCP) :

In the dynamic method, IP addresses are assigned automatically to devices using DHCP, which eliminates the need for manual configuration and makes the network scalable and easy to manage.

 

📖 What is DHCP ?

DHCP (Dynamic Host Configuration Protocol) is a network protocol that is used to automatically assign IP addresses and other necessary network configuration details such as subnet mask, default gateway, DNS server, and lease time to devices in a network, so that users do not need to configure these settings manually and communication can happen smoothly without errors.

 

🧠 Basic Idea

👉 DHCP simply means:
Devices automatically get IP address without manual setup

 

📊 DHCP Components

The DHCP system works based on two main components, where one device provides the configuration and the other device receives it to communicate in the network.

 

1️⃣ DHCP Server :

The DHCP server is the device responsible for assigning IP addresses and network settings to clients, and it can be a router or a dedicated server that maintains a pool of available IP addresses and distributes them whenever requested.

 

2️⃣ DHCP Client :

The DHCP client is any device such as a PC, laptop, server, or printer that requests an IP address from the DHCP server in order to communicate within the network.

 

🔄 DHCP Working (DORA Process)

The communication between the DHCP client and the DHCP server takes place through a structured process known as the DORA process, where a series of messages are exchanged step by step to ensure that the client receives a valid IP address along with all required network information.

 

📌 DORA Process Explained

1️⃣ Discover :

In this step, the DHCP client sends a broadcast message to all devices in the network, including the DHCP server, in order to discover any available DHCP server that can provide an IP address.

2️⃣ Offer :

After receiving the discover message, the DHCP server responds by offering an available IP address from its pool to the client.

3️⃣ Request :

The DHCP client then sends a request message to the server indicating that it wants to accept the offered IP address.

4️⃣ Acknowledgement (ACK) :

Finally, the DHCP server sends an acknowledgement message confirming the assignment of the IP address, along with additional information such as lease time, subnet mask, gateway, and DNS server.

 

⚠️ DHCP Failure

In some situations, DHCP may fail due to reasons such as the DHCP server being offline, not reachable, or not responding to client requests, which prevents devices from receiving an IP address automatically.

 

🌐 APIPA (Automatic Private IP Addressing)

When DHCP fails, the client device automatically assigns itself an IP address using a mechanism called APIPA, which allows the device to communicate with other devices within the same local network even without a DHCP server.

 

📌 What is APIPA

APIPA (Automatic Private IP Addressing) is a special type of link-local IP address that is automatically assigned by the system when no DHCP server is available, enabling limited communication within the LAN.

📊 APIPA Range : 169.254.0.0 → 169.254.255.255

 

⚠️ Important Points about APIPA

  • Used only when DHCP fails 
  • Works only within same LAN 
  • No internet connectivity 
  • Also called Link-Local Address 

 

📦 Information Provided by DHCP

The DHCP server not only assigns an IP address but also provides other important network configuration details required for proper communication.

 

📌 It provides:

  • IP Address 
  • Subnet Mask 
  • Default Gateway 
  • DNS Server 
  • Lease Time 

 

⚙️ Advantages of DHCP

DHCP provides several benefits in real-world networks by simplifying the process of IP management and reducing the chances of errors.

  • Automatic IP assignment 
  • Reduces manual work 
  • Prevents IP conflicts 
  • Easy to manage large networks 
  • Saves time 

 

❌ Disadvantages of DHCP

Despite its advantages, DHCP also has some limitations that must be considered in network design.

  • Dependency on DHCP server 
  • If server fails → no IP assignment 
  • Security risks (rogue DHCP server) 
  • Less control over IP allocation 

 

⚠️ Important Points

  • Works on Client-Server model 
  • Uses UDP protocol 
  • Ports:  
    • 67 → Server 
    • 68 → Client 
  • Uses broadcast communication

 

📌 DHCP Configuration Syntax :

ip dhcp pool <pool-name>
network <network-address> <subnet-mask>
default-router <gateway-ip>
dns-server <dns-ip>
exit

 

🔍 Explanation of Syntax :-

  • ip dhcp pool <pool-name>
    → Creates a DHCP pool (group of IP addresses) 
  • network <network-address> <subnet-mask>
    → Defines the network range for IP assignment 
  • default-router <gateway-ip>
    → Specifies the default gateway for clients 
  • dns-server <dns-ip>
    → Provides DNS server address 

 

⚠️ Important Command (Very Important)

Before creating DHCP pool, we must exclude some IP addresses so that they are not assigned to clients.

ip dhcp excluded-address <start-ip> <end-ip>

👉 Used to reserve IPs (for router, server, etc.)

 

⚙️ Steps to Configure DHCP :-

 

1️⃣ Enable Privileged Mode

Router> enable

 

2️⃣ Enter Global Configuration Mode

Router# configure terminal

 

3️⃣ Exclude IP Addresses

In this step, important IP addresses such as gateway or server IPs are excluded so that DHCP does not assign them to clients.

Router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10

 

4️⃣ Create DHCP Pool

Router(config)# ip dhcp pool LAN1

 

5️⃣ Define Network

Router(dhcp-config)# network 192.168.1.0 255.255.255.0

 

6️⃣ Set Default Gateway

Router(dhcp-config)# default-router 192.168.1.1

 

7️⃣ Configure DNS Server (Optional but Recommended)

Router(dhcp-config)# dns-server 8.8.8.8

 

8️⃣ Exit Configuration

Router(dhcp-config)# exit

 

📊 Verification Commands :-

 

🔍 Check DHCP Pool : show ip dhcp pool

🔍 Check Assigned Ips : show ip dhcp binding

🔍 Check DHCP Process : show running-config

 

⚠️ Important Points

  • Always exclude gateway IP 
  • DHCP works only within same network (without relay) 
  • Clients must be set to DHCP mode 
  • Router acts as DHCP server 


 

🔗DHCP Implementation in Local Area Network 

 

🌐 Introduction

In this topology, DHCP is configured on a router to automatically assign IP addresses to client devices connected in the same LAN, where the router acts as a DHCP server and provides network configuration dynamically, allowing devices to communicate without manually assigning IP addresses.

 

🧠 Topology Overview

👉 This topology consists of:

  • 1 Router (DHCP Server) 
  • 1 Switch 
  • Multiple PCs (DHCP Clients) 

👉 One device can also be manually configured (example: server)

 

🌐 Network Details

Network Address: 192.168.100.0/24
Gateway: 192.168.100.1

 

⚙️ Router Configuration (DHCP Server)

 

🔧 Configuration Steps :-

 

Router> enable
Router# configure terminal

! Exclude important IPs
Router(config)# ip dhcp excluded-address 192.168.100.1 192.168.100.10

! Create DHCP Pool
Router(config)# ip dhcp pool LAN1

! Define Network
Router(dhcp-config)# network 192.168.100.0 255.255.255.0

! Set Default Gateway
Router(dhcp-config)# default-router 192.168.100.1

! Set DNS Server (optional)
Router(dhcp-config)# dns-server 8.8.8.8

Router(dhcp-config)# exit

 

🌐 Interface Configuration (Router) :

Router(config)# interface fa0/0
Router(config-if)# ip address 192.168.100.1 255.255.255.0
Router(config-if)# no shutdown
Router(config-if)# exit

 

💻 Client Configuration :-

📌 On PC / Laptop

👉 Go to:

Desktop → IP Configuration → Select DHCP

 

🧠 What Happens

When DHCP is enabled on client:

  • Client sends Discover 
  • Router replies with Offer 
  • Client sends Request 
  • Router sends ACK 

👉 IP gets assigned automatically

 

📊 Verification :-

 

📖 Description

After enabling DHCP on client devices, the system automatically assigns IP addresses from the DHCP pool.

 

✅ What to Check

  • IP address assigned automatically 
  • Subnet mask correct 
  • Default gateway assigned 

 

🔍 Check DHCP Binding :

Command : show ip dhcp binding

Output :

 

📖 Description

This command shows all the IP addresses assigned to clients by DHCP server.

 

🔗 Connectivity Test :-

📖 Description

Connectivity is tested by sending ping from one client to another device in the network.

 

💻 Example

ping 192.168.100.4

 

✅ Result

  • Ping replies received 
  • Network working properly 
  • DHCP successfully assigning IPs 

 

⚠️ Important Points :-

  • Always exclude gateway IP 
  • Router acts as DHCP server 
  • Clients must be in DHCP mode 
  • DHCP works within same LAN (without relay) 

 

🎯 Key Idea

👉 DHCP in topology =
Router assigns IP automatically to all clients

 

🎯 Summary

In this topology, DHCP is configured on the router to dynamically assign IP addresses to client devices, eliminating manual configuration and ensuring smooth communication within the network.

 

👉 👉 Explore the DHCP practical setup to see automatic IP assignment in action:

https://www.evisiontechnoserve.com/internships/it/45-days-job-internship-program-live