Site is Under Maintenance
Please come back again in...
00 Days
00 Hours
00 Minutes
00 Seconds

Configuring Cisco IOS DHCP Server Tutorial

configuring-the-cisco-ios-dhcp-server.htm

Configuring Cisco IOS DHCP Server

Small offices don’t necessarily have dedicated DHCP Servers so its quite common to embedded this service into routers and/or switches. This lab will discuss and demonstrate the configuration and verification of the Cisco IOS DHCP Server.

Real World Application & Core Knowledge

In the world of networking it can be a real big pain when you have to assign static IP addresses to hundreds of different PC’s on the network. The fix for this is Dynamic Host Configuration Protocol which is a type of server that can provide an ip address automatically to network host requesting an IP Address on the network.

DHCP in general has a pretty simple operational concept. It responds to DHCP request from PCs on the network. DHCP can provide several different attributes during its reply to a host request such as domain name, WINS Server(s), DNS Server(s), default gateway, NTP Server, TFTP Options etc…

In a network of 5000 PC’s it would take several hundred man hours to assign IP addresses to each machine however using DHCP will cut the several hundred hours down to a few hours of careful planning and implementation of a DHCP Server on the network.

DHCP is used in nearly every single network in the world today however there are some benefits of assigning IP Addresses statically such as IP addressing in a demilitarized zone (DMZ) or for servers in a data center and of course all network infrastructure devices which include routers, switches, firewalls and etc… should be assigned static IP addresses.

It’s common to configure a DHCP server on a Cisco Router or Switch that is used in a small branch office. For example a branch office has a single T1 and if you have the network configured in a way the DHCP server exist on the other side of the T1 then if the T1 ever fails, PC’s on the network will not be able to obtain a DHCP address and thus could prevent site local productivity such as printing or site local servers.

When first learning about DHCP the first question that is often the most puzzling question is how does a DHCP server know to provide a host an IP address in 10.114.12.0/24 network when the DHCP server is in the 10.114.94.0/24 network?

This is done through the use IP helper addresses which will be discussed in Lab 11-6.

There are several configuration requirements to a Cisco IOS DHCP Server. The first step is to create a DHCP pool on a Cisco router or switch. To create the pool you must name the pool. This is done by using the ip dhcp pool <i>POOL_NAME</i>

Once you’ve created the DHCP Pool you’ll be placed into DHCP configuration mode denoted by the hostname(dhcp-config)# prompt.

There are several variables you must assign to the pool, the first being optional which is the domain name which will be assigned to host learning the DHCP addresses. This is configured using the domain-name <i>NAME</i>

Next up would be the pool’s network in which the pool provides DHCP address to host from. This is configured using the network A.B.C.D /x whereas A.B.C.D is the network address and the /x is the CIDR netmask. Example; 225.255.255.0 = /24

You have the ability to specify how long the DHCP can lease out its IP addresses to host machines by using the lease <i>days hours minutes seconds</i> command. The default is 24 hours.

The DNS Server(s) can be automatically learned via DHCP replies from a host. To configure the DHCP server to provide DNS Server information in Cisco IOS, you’ll use the dns-server A.B.C.D. If you wish to add multiple DNS servers then add the second DNS servers ip address after the first one. Example; dns-server 10.114.12.16 10.114.54.16.

If you still use the Microsoft WINS service in your network infrastructure you have the ability to specify the WINS servers to be included in the DHCP response. To specify WINS servers on the Cisco IOS DHCP Server use the netbios-name-server A.B.C.D. The same command syntax that is used by DNS is also used to configure multiple WINS servers.

The last and most important option that will be discussed in this lab is the default gateway option. When a host PC on the network request a DHCP address it does not know the default gateway automatically but will be learned via the DHCP reply. To configure the Cisco IOS DHCP server to include the default gateway information in the DHCP responses then you’ll need to use the default-router A.B.C.D command.

In this lab you will configure R1 as a DHCP server and R2 as a DHCP client to simulate a PC on the network.

Familiarize yourself with the following new command(s) listed below;

| Command | Description |
| ip dhcp pool POOL_NAME | This command is executed in global configuration mode to create a new Cisco IOS DHCP Server pool. |
| domain-name NAME | This command is executed in DHCP configuration mode to specify a domain name to be included in DHCP replies. |
| network A.B.C.D /x | This command is executed in DHCP configuration mode to specify a network in which the DHCP pool provides DHCP addresses from to host clients upon request. |
| lease days hours minutes seconds | This command is executed in DHCP configuration mode to specify the DHCP address lease time of IP addresses allocated by that DHCP Server. The default is 24 hours. |
| dns-server 10.114.12.16 10.114.54.16 | This command is executed in DHCP configuration mode to specify DNS Server(s) to be included in DHCP replies. |
| netbios-name-server A.B.C.D | This command is executed in DHCP configuration mode to specify WINS Server(s) to be included in DHCP replies. |
| default-router A.B.C.D | This command is executed in DHCP configuration mode to specify the default gateway that will be included in DHCP replies. |

The following logical topology shown below is used in this lab;

Lab Prerequisites

  • If you are using GNS3 than load the Free CCNA Workbook GNS3 topology than start devices; R1, R2 and SW1.
  • Establish a console session with devices R1, R2 and SW1 than load the initial configurations provided below by copying the config from the textbox and pasting it into the respected routers console.

!###################################################
!# Free CCNA Workbook Lab 11-4 R1 Initial Config #
!###################################################
!
enable
configure terminal
!
hostname R1
no ip domain-lookup
!
interface FastEthernet0/0
description ### LAN INTERFACE ###
ip address 10.114.12.1 255.255.255.0
no shut
!
line con 0
logging sync
no exec-timeout
!
end

!###################################################
!# Free CCNA Workbook Lab 11-4 R2 Initial Config #
!###################################################
!
enable
configure terminal
!
hostname R2
no ip domain-lookup
!
interface FastEthernet0/0
description ### LAN INTERFACE ###
no shut
!
line con 0
logging sync
no exec-timeout
!
end

!###################################################
!# Free CCNA Workbook Lab 11-4 SW1 Initial Config #
!###################################################
!
enable
configure terminal
!
hostname SW1
no ip domain-lookup
!

!
line con 0
logging sync
no exec-timeout
!
end

Lab Objectives

  • Create a DHCP pool on R1 using the name “LAB_POOL1”
  • Assign the domain name “TESTLAB.LOCAL” to the DHCP pool “LAB_POOL1”
  • Assign the network 10.114.12.0/24 to the DHCP pool “LAB_POOL1”
  • Assign the DHCP Address lease time of 7 days to the DHCP pool “LAB_POOL1”
  • Assign the DNS Servers 10.114.18.6 and 10.114.18.7 to the DHCP pool “LAB_POOL1”
  • Assign the WINS Servers 10.114.18.4 and 10.114.18.5 to the DHCP pool “LAB_POOL1”
  • Assign the default gateway of 10.114.12.1 to the DHCP pool “LAB_POOL1”
  • Configure R2’s FastEthernet0/0 interface to obtain an IP Address via DHCP. Verify that R1 has provided R2 a DHCP IP address and that you can ping R1’s FastEthernet0/0 interface using the newly acquired DHCP address.

Lab Instruction

Objective 1. – Create a DHCP pool on R1 using the name “LAB_POOL1”

R1>enable
R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#ip dhcp pool LAB_POOL1

<br>

Objective 2. – Assign the domain name “TESTLAB.LOCAL” to the DHCP pool “LAB_POOL1”

R1(dhcp-config)#domain-name TESTLAB.LOACL

Objective 3. – Assign the network 10.114.12.0/24 to the DHCP pool “LAB_POOL1”

R1(dhcp-config)#network 10.114.12.0 /24

Objective 4. – Assign the DHCP Address lease time of 7 days to the DHCP pool “LAB_POOL1”

R1(dhcp-config)#lease 7

Objective 5. – Assign the DNS Servers 10.114.18.6 and 10.114.18.7 to the DHCP pool “LAB_POOL1”

R1(dhcp-config)#dns-server 10.114.18.6 10.114.18.7

Objective 6. – Assign the WINS Servers 10.114.18.4 and 10.114.18.5 to the DHCP pool “LAB_POOL1”

R1(dhcp-config)#netbios-name-server 10.114.18.4 10.114.18.5

Objective 7. – Assign the default gateway of 10.114.12.1 to the DHCP pool “LAB_POOL1”

R1(dhcp-config)#default-router 10.114.12.1
R1(dhcp-config)#end
R1#

Objective 8. – Configure R2’s FastEthernet0/0 interface to obtain an IP Address via DHCP. Verify that R1 has provided R2 a DHCP IP address and that you can ping R1’s FastEthernet0/0 interface using the newly acquired DHCP address.

To verify that FastEthernet0/0 has learned its IP address via DHCP use the show ip interface brief command.

R2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#interface Fastethernet0/0
R2(config-if)#ip address dhcp
R2(config-if)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#
%DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 10.114.12.2, mask 255.255.255.0, hostname R2

R2#show ip interface brief FastEthernet0/0
Interface                  IP-Address      OK? Method Status      Protocol
FastEthernet0/0            10.114.12.2      YES DHCP   up          up
R2#ping 10.114.12.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.114.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/59/152 ms
R2#

Rate This Article

Thanks for reading: Configuring Cisco IOS DHCP Server Tutorial, Sorry, my English is bad:)

Getting Info...

About the Author

I'm Aevon...Just a gal with an insane passion for all things cybersecurity. 17 years in the industry and still love what I'm doing.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.