CCNA BootCamp

4 Certs Included!

Skillset

DHCP (dynamic host configuration protocol) is used for dynamically assigning network addresses to hosts. DHCP operates on a client-server model, where a DHCP server sends configuration information to DHCP clients. The CCNA (Cisco Certified Network Associate) exams require you to understand DHCP and be able to configure and verify it on Cisco routers. In this article we will provide an introduction to DHCP, going into details relevant to CCNA. We will also develop a topology in GNS3 to practice the concepts hands on. The current article belongs to the GNS3 Labs for CCNA series and assumes you already have a GNS3 installation in working order. If that’s not you and you need help setting up GNS3 from scratch. you should read the article GNS3 Labs for CCNA: Getting Started first and then come back here.

DHCP is based on BOOTP (bootstrap protocol), which provides the framework for passing configuration information to hosts on a TCP/IP network. The main advantage of DHCP over BOOTP is that you don’t need to configure MAC addresses of all clients on the DHCP server.

The graphic below shows the message exchange between a DHCP server and client:

The steps shown in the graphic are explained below:

The operating system on the host is configured to obtain network configuration via DHCP, so the host, acting as DHCP client, sends a DHCPDISCOVER broadcast message to locate a DHCP server.

A DHCP server on the local subnet offers configuration parameters, including an IP address, to the client in a DHCPOFFER unicast message.

The DHCP client returns a formal request for the offered IP address to the server in a DHCPREQUEST broadcast message.

The DHCP server confirms that the IP address has actually been allocated for use by the client by returning the final DHCPACK unicast message.

The interaction of a DHCP server and client looks just like what we presented when the client and server are both on the same broadcast domain/subnet. If that’s not the case, a DHCP relay agent is needed, in addition to client and server. A DHCP relay agent is any host that forwards DHCP packets between DHCP clients and DHCP servers. In practice, DHCP servers are often centrally located and you almost always need a DHCP relay agent to forward messages back and forth between the client and server. A DHCP relay agent does more than simply forwarding DHCP packets like a router forwarding IP packets. The relay agent receives DHCP messages and then generates a new DHCP message to send on another interface. The Cisco IOS (Internetwork Operating System) running on Cisco routers includes both DHCP server and relay agent software and we are going to cover the configuration of both features in this article.

DHCP Server Configuration and Verification

In the first article of the series (GNS3 Labs for CCNA: Getting Started), we set up GNS3 and created a simple topology with two routers, but we did not add any hosts. In this article, it will probably be useful to add a couple of hosts to see our DHCP server in action, actually assigning addresses. So let’s learn how to add hosts to GNS3 before moving on to DHCP configuration.

The GNS3 0.8.6 all-in-one package that we are using comes bundled with version 0.11.0 of the Qemu emulator. You will use Qemu to emulate a lightweight distribution of Linux called Micro Core. You should download the Qemu appliance for Linux Micro Core from http://sourceforge.net/projects/gns-3/files/Qemu%20Appliances/linux-microcore-3.8.2.img and save it to the directory C:\Images on your Windows system. You need also to configure GNS3 by going to Edit > Preferences > Qemu and then, on the tab labeled Qemu Guest, do as shown in the graphic below. Finally, you have to press the Save and OK buttons in succession.

In this article, we will use the topology shown below. We are making the GNS3 topology and initial configuration files available freely as a RAR archive. You should download the archive and decompress it using a utility like WinRAR to a folder on your computer. The topology provided comes pre-configured with IP addresses and static routing. The idea is to come straight to the point we are covering in this article.

You have to double click the downloaded topology.net file and GNS3 should launch automatically. You have to start all devices once the topology is loaded in GNS3. The devices will all come alive with initial configurations. First, you should go to R1 and add the following configuration to make it act as a DHCP server for directly connected hosts as well as for hosts connected to R2 on the remote LAN.

We have defined a DHCP pool named Pool_R1 that includes all addresses in the subnet 192.168.1.0/24. The default router/gateway is 192.168.1.1 that happens to be the IP address on FastEthernet0/0 of R1. We have plans of possibly making R1 our DNS server in future (not in this article), so the DNS server too is 192.168.1.1. The command leasedays hours minutes has been used to configure a DHCP lease duration of 23 hours and 59 minutes or almost a full day, after which clients must renew their addresses. The command ip dhcp excluded-address has been used to prevent the server from assigning the first 50 IP addresses in the pool. We plan to configure these reserved addresses statically on servers that need to have permanent IP addresses. Finally, we used the command domain-name to set the domain name arbitrarily to intenseschool.com.

You may now go to the host labeled MicroCore on the left and verify if it has obtained an IP address from R1 over DHCP. Please note that the default login for Qemu Micro Core Linux appliance is tc with no password.

The router R1 is supposed to act as DHCP server for local hosts as well as for remote hosts connected to R2. You have to add the following configuration to R1 to make it act as a DHCP address for hosts connected to FastEthernet0/0 of R2.

We created another DHCP address pool named Pool_R2 with configuration quite similar to the configuration of Pool_R1. The configuration done so far on R1 is not enough to allow hosts on the LAN connected to R2 obtain network addresses. The reason is that hosts connected to R2 and R1 are not in the same broadcast domain. The DHCPDISCOVER messages sent by those remote hosts simply cannot reach R1. You need to add the following configuration to R2 to make it act as DHCP relay agent.

interface FastEthernet0/0
ip helper-address 172.16.12.1

The DHCP relay agent feature requires just the ip helper-address command configured under FastEthernet0/0 of R2. You may now go to the host on right labeled MicroCore_2 and verify that it has received its IP address from R1.

You can see that MicorCore_2 has obtained 192.168.2.51 as its IP address from the DHCP server running on R1.

We successfully configured the DHCP server and relay agent on R1 and R2, respectively. The verification came directly from examining IP addresses assigned to hosts. Now let’s have a closer look at the state of DHCP server on R1, using show commands.

The DHCP server implementation in Cisco IOS also tries to detect conflicts between assigned and statically configured addresses. You have seen the ip dhcp excluded-address command, which tries to prevent address conflicts. But there is nothing in the world that can prevent someone from statically configuring an IP address from within the range of addresses used by the DHCP server. DHCP servers detect such conflicts by pinging the new IP address before assigning it to a client. The show ip dhcp conflict command lists all address conflicts known to the DHCP server. The DHCP server avoids assigning the addresses from the list to any clients until the list is manually cleared using the clear ip dhcp conflict command.

We have come to the conclusion of the article, but you still have to do two things in order to make sure your configurations are available the next time you load the topology in GNS3. First, do write memory or copy running-config startup-config on all routers in the topology. Second, save the project from File > Save project as… We hope to see you again with another article in the GNS3 Labs for CCNA series covering another topic from the new CCNA version 2.

Muhammad Furqan, CCIE Routing & Switching, currently works as an engineer at a global provider of networking and information technology services. He has a degree in Computer Engineering and enjoys writing articles and tutorials on networking and related topics. Reach him at muhammad.furqan@gmail.com or connect with him on Twitter @MuhammadFurqan.

pliz, i really need guidance on how to better my networking skills. i finished my cisco 1,2,3,4 exams back in 2007, till now have no job. now employed as a data specialist, my inetrest lies in the field of networking

It’s actually a cool and useful piece of information.
I’m glad that you just shared this useful information with us.
Please stay us up to date like this. Thank you for sharing.

tran_phong

MicroCore : Ok
MricroCore_2: Ok when i make a default route to 172.16.12.2 .Why???

About Intense

Intense School has been providing accelerated IT training and certification for over 12 years to more than 45,000 IT and Information Security professionals worldwide. Come see why we have the highest pass rates in the industry!

Join our newsletter

File download

First Name

Last Name

Work Phone Number

Work Email Address

Job Title

How will you fund your training?

Why Take This Training?

What is your timeline for training?

InfoSec institute respects your privacy and will never use your personal information for anything other than to notify you of your requested course pricing. We will never sell your information to third parties. You will not be spammed.

Comments

What is Skillset?

Skillset

Practice tests & assessments.

Practice for certification success with the Skillset library of over 100,000 practice test questions. We analyze your responses and can determine when you are ready to sit for the test. Along your journey to exam readiness, we will:

1. Determine which required skills your knowledge is sufficient
2. Which required skills you need to work on
3. Recommend specific skills to practice on next
4. Track your progress towards a certification exam