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.
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 POOL_NAME
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 NAME
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; 22.214.171.124 = /24
You have the ability to specify how long the DHCP can lease out its IP addresses to host machines by using the lease days hours minutes seconds 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;
|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;
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
Objective 2. – Assign the domain name “TESTLAB.LOCAL” to the DHCP pool “LAB_POOL1”
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”
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#