USD ($)
$
United States Dollar
India Rupee

Cisco Switch: Configure DHCP Scenario

Created by Gautam Sharma in Articles 28 May 2024
Share


In an organization, IT infrastructure may have several devices which require IP addresses to function in the network. For example a laptop can not access network resources like internet without having an IP, gateway and DNS addresses.

There are two ways by which we can configure these parameters in a machine like laptop or any network devices.

1. Manually Assigned

2. Dynamically Assigned

In case you have very limited network devices in you IT infrastructure, you can assign IP and other addresses manually but if you have a large enterprise having hundreds or thousands of network devices then it is very much convenience to assign IPs dynamically. 

The process of assigning the IP parameters on network devices are called Dynamic Host Configuration Protocol (DHCP). It is a network management protocol, allowing devices to receive IP related information from DHCP servers, the information is as follows 

- IP Addresses

- Subnet Masks

- Default Gateways

- DNS Server Addresses  

The network professionals obtain training and certifications for building concepts of configuring DHCP on Cisco Switch or Router. There are some small organization where they do not effort to keep a dedicated DHCP server for assigning IP addresses dynamically, they use cisco switch to configure dhcp which is easy to setup.

Understanding DHCP is a fundamental aspect of Cisco training and certification programs. Cisco certifications, such as the Cisco Certified Network Associate (CCNA), cover DHCP extensively as part of their curriculum. CCNA training online and certification ensures that network professionals have the knowledge and skills to implement and manage DHCP in real-world scenarios. You feel free to contact our learning advisors for further information on training and skill development.




Cisco Switch Configure DHCP - Tasks

In this task, SW1 will be configured as a DHCP Server, and all four routers will be DHCP Clients. Configure DHCP Server functionality on SW11 using the following criteria:


Pool Name

Network Address

Subnet Mask

Default Router

Lease Time

vlan2

10.10.10.8

/29

10.10.10.9

1-day

vlan3

10.10.10.32

/29

10.10.10.33

1-day

vlan4

30.30.30.0

/26

30.30.30.1

1-day

vlan5

20.20.20.96

/27

20.20.20.97

1-day


Cisco Switch as DHCP Server - Explanation

In this blog, we are going to discuss and configure Cisco switch as DHCP server. Before directly jump on to the configuration, let's first understand how it works.

How DHCP Works?

The DHCP process has the following steps while assigning IP parameters to a network device.


1. DHCP Discovery

When a device wants to join a network, it first starts sending a broadcast message called a DHCP discover in order to locate available DHCP servers.


2. DHCP Offer

When any available DHCP server receives this discovery broadcast message, it responds to the client with a DHCP offer. In this offer, it includes a free available IP address and other configuration parameters to the client.


3. DHCP Request

When a DHCP client receives the DHCP offer (client may receive multiple offers), it responds in a broadcast message ias DHCP request, containing the IP address of a specific server from which this client wants to accept the offer.


4. DHCP Acknowledgement

Once the chosen server receives the DHCP request from the client, it sends a DCHP acknowledgement back to the client. This confirms that the IP address and other details can now be used by the client for further communication in the network.

In this setup, there are three Cisco switches and four routers. Configure all FastEthernet interfaces on the routers (connected to the switches shown in the topology diagram) to obtain their IP address dynamically via Cisco switch as DHCP server. Verify that your routers have obtained an appropriate DHCP IP address. 

Verify that any one of your routers can ping the IP address of any other router. 

DHCP Configuration in Cisco Switch


Step #1: Configure VTP mode Server , VTP domain CCNP and verify that all ports are trunk negotiated.



Step #2: Configure the L2 VLAN for all VLANs on SW1.

SW1:

SW1#conf t

Enter configuration commands, one per line. End with CNTL/Z.
SW1(config-vlan)#vlan 3
SW1(config-vlan)#vlan 4
SW1(config-vlan)#vlan 5
SW1(config-vlan)#

SW1(config)#vlan 2


Step #3: Verify that al ports connected to switch are 802.1Q trunk port. Configure the L3 VLAN for all VLANs on SW1.





SW1:

SW1(config)#ip routing
SW1(config)#interface Vlan1
SW1(config-if)# ip address 1.1.1.11 255.255.255.0
SW1(config-if)#!
SW1(config-if)#interface Vlan2
SW1(config-if)# ip address 10.10.10.9 255.255.255.248
SW1(config-if)#!
SW1(config-if)#interface Vlan3
SW1(config-if)# ip address 10.10.10.33 255.255.255.248
SW1(config-if)#!
SW1(config-if)#interface Vlan4
SW1(config-if)# ip address 30.30.30.1 255.255.255.192
SW1(config-if)#!
SW1(config-if)#interface Vlan5
SW1(config-if)# ip address 20.20.20.97 255.255.255.224
SW1(config-if)#!
SW1(config-if)#
SW1#conf t
SW1(config)#int vlan 2
SW1(config-if)#no shut
SW1(config-if)#int vlan 3
SW1(config-if)#no shut
SW1(config-if)#int vlan 4
SW1(config-if)#no shut
SW1(config-if)#int vlan 5
SW1(config-if)#no shut
SW1(config-if)#^Z

SW1(config)#!

Enter configuration commands, one per line. End with CNTL/Z.


Step #4: Verify the L3 VLAN for all VLANs on SW1.



Step #4: Configure the Switch port on all switch who are connected to all four routers .

SW1:

SW1(config)#int eth1/0

SW1(config-if)#switchport mode access

SW1(config-if)#switchport access vlan 2

SW1(config-if)#no shut
SW1(config)#int eth2/0
SW1(config-if)#switchport access vlan 2
SW1(config-if)# switchport mode access
SW1(config-if)# duplex auto
SW1(config-if)#end


SW2:

SW2(config)#int eth1/0

SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 3
SW2(config-if)#int eth2/0
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 3
SW2(config-if)#^Z
SW2(config)#int eth3/0
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 5
SW2(config-if)#int eth4/0
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 5
SW2(config-if)#^Z
SW3(config)#int eth3/0
SW3(config-if)#switchport mode access
SW3(config-if)#switchport access vlan 4
SW3(config-if)#int eth4/0
SW3(config-if)#switchport mode access
SW3(config-if)#switchport access vlan 4
SW3(config-if)#^Z

 

Step #5: Configure the SW1 to make it as DHCP server .

SW1:

SW1(config)#ip dhcp pool vlan2

SW1(dhcp-config)# network 10.10.10.8 255.255.255.248

SW1(dhcp-config)# default-router 10.10.10.9

SW1(dhcp-config)#!

SW1(dhcp-config)#ip dhcp pool vlan3

SW1(dhcp-config)# network 10.10.10.32 255.255.255.248

SW1(dhcp-config)# default-router 10.10.10.33

SW1(dhcp-config)#!

SW1(dhcp-config)#ip dhcp pool vlan4

SW1(dhcp-config)# network 30.30.30.0 255.255.255.192

SW1(dhcp-config)# default-router 30.30.30.1

SW1(dhcp-config)#!

SW1(dhcp-config)#ip dhcp pool vlan5

SW1(dhcp-config)# network 20.20.20.96 255.255.255.224

SW1(dhcp-config)#  default-router 20.20.20.97

 

Step #6: Configure the Routers so that it will take the ip address from DHCP server.

R1:

R1(config)#int range eth0/0-1
R1(config-if-range)#no shut
R1(config-if-range)#ip address dhcp


R2:

R2(config)#int range eth0/0-1
R2(config-if-range)#no shut
R2(config-if-range)#ip address dhcp


R3:

R3(config)#int range eth0/0-1
R3(config-if-range)#no shut
R3(config-if-range)#ip address dhcp


R4:

R4(config)#int range eth0/0-1
R4(config-if-range)#no shut
R4(config-if-range)#ip address dhcp

 
Step #8: Verification that All routers are able to get the Ip address






Gautam Sharma

This is Gautam's biography

More... | Author`s Bog | Book a Meeting

Related Articles

#Explore latest news and articles

What is Port Address Translation: Cisco ASA 5 May 2024

What is Port Address Translation: Cisco ASA

Understand what is port address translation and configure it on Cisco ASA. Learn the difference between NAT and PAT. 
What is BGP and How Does it Work? 11 May 2024

What is BGP and How Does it Work?

Discover what is BGP and how it works. The concepts lay the foundation for a deeper understanding of internet routing.
What is OSPF and How it Works? 12 May 2024

What is OSPF and How it Works?

Do you know? what is OSPF and how it works in networking. The IGP protocol concepts lay the foundation for becoming an expert. Read More!

FAQ

When an organization has limited resources for assigning a dedicated server for DHCP then Cisco switch can be used for assigning IP addresses dynamically to network clients.
IP address, Subnet mask, Gateway IP, DNS address
Linux servers, Windows server, AWS and other cloud platforms as DHCP server. Cisco routers can also be DHCP server in small organizations.

Comments (0)

Share

Share this post with others

Contact learning advisor

New Cisco ACI Training Live Batch Starts June 15th!
New Cisco ACI Training Live Batch Starts June 15th!
Advance your career? Don't miss out on our Cisco Application Centric Infrastructure (ACI) training ...
Enroll Now