Remote DHCP Server 1

DHCP plays a huge role in most IPv4 networks. In some cases, the server sits on the same subnet as the client, but in other cases, the DHCP server is remote. When it is remote, you need to configure the DHCP relay agent feature as well. Today’s lab: configure that centralized DHCP server, and make sure the remote clients can get a lease from that server.
Requirements
For this lab, configure R1 to act as the DHCP server for two remote subnets off routers R2 and R3 as shown in the figure. Specifically:
- Use a DHCP pool per Subnet (Names: One and Two)
- Configure the correct default gateway configuration; you decide on the correct values.
- Configure a DNS IP addresses of 172.30.3.8 and 172.30.3.9.
- Set the domain name for the network to example.com.
- Set the lease length to 1 day, 2 hours, and 3 minutes long.
- Prevent the server from assigning to clients the IP addresses used by the routers in those subnets.
- Assume all router interfaces shown in the lab are up, working and the appropriate interfaces have been configured with IP addresses (per the initial configuration).
- Assume all routing protocol configuration is correct between routers, so that all routers learn routes for all subnets
Figure 1: Remote DHCP Topology
Initial Configuration
Example 1, 2, 3, and 4 show the beginning configuration state of R1, R2, R3 and SW1.
Example 1: R1 Config
hostname R1
!
interface GigabitEthernet0/1
ip address 172.30.3.1 255.255.255.0
no shutdown
!
router rip
version 2
network 172.30.0.0
Example 2: R2 Config
hostname R2
!
interface GigabitEthernet0/1
ip address 172.30.3.2 255.255.255.0
no shutdown
!
interface GigabitEthernet0/2
ip address 172.30.1.1 255.255.255.0
no shutdown
!
router rip
version 2
network 172.30.0.0
Example 3: R3 Config
hostname R3
!
interface GigabitEthernet0/1
ip address 172.30.3.3 255.255.255.0
no shutdown
!
interface GigabitEthernet0/2
ip address 172.30.2.1 255.255.255.0
no shutdown
!
router rip
version 2
network 172.30.0.0
Example 4: SW1 Config
hostname SW1
!
interface GigabitEthernet0/1
switchport mode access
!
interface GigabitEthernet0/2
switchport mode access
!
interface GigabitEthernet0/3
switchport mode access
Answer on Paper, or Maybe Test in Lab
Next, write your answer on paper. Or if you have some real gear or other tools, configure the lab using them.
To test your solution if you happen to try it with CML/VIRL or real gear, use something that will attempt to use DHCP to lease an IPv4 address. On hosts, you can set the host to use DHCP. For instance, on Windows OS’s, use commands like ipconfig /release (to release the lease) and ipconfig /renew (to attempt a new lease). On Linux, try sudo dhclient –r to release, and sudo dhclient to lease a new address.
Alternately, if you have Cisco switches to use, include a switch connected the G0/2 interfaces of both R2 and R3. Then you can make each switch use DHCP for its own management IP address. For example, if R2 is connected to a LAN switch, and the switch used VLAN 1 on all ports, you could configure the commands interface vlan 1 followed by ip address dhcp to make the switch attempt to lease an address to use for interface VLAN 1. The show interfaces vlan 1 command on the switch will then show if the switch obtained its address or not.
Do this Lab with Cisco’s CML (Formerly VIRL)
You can do these labs on paper and still get a lot out of the lab. As an extra help, we have added files for Cisco Modeling Lab – Personal (CML-P). CML-P replaces Cisco Virtual Internet Routing Lab (VIRL) software, in effect serving as VIRL Version 2.
Below, find two files: a file useful with CML-P and another useful with VIRL. (Note that the CML-P file has a .yaml filetype, while the older VIRL file has a VIRL filetype.) Once the file is loaded, CML-P or VIRL will create a lab topology similar to this lab’s topology, with the initial configuration shown in the lab as well.
The CML/virl topology matches this lab topology exactly. The host info does as well.
Host device info:
This table lists host information pre-configured in CML/VIRL, information that might not be required by the lab but may be useful to you.
Device |
IP Address |
User/password |
PC1 |
DHCP |
cisco/cisco |
PC2 |
DHCP |
cisco/cisco |
PC3 |
DHCP |
cisco/cisco |
Handy Host Commands:
To see PC IP address: ifconfig eth1
Ping example: ping -c 4 10.1.1.1
Trace example: tracepath 10.1.1.1
To connect to another node within the topology: telnet 10.1.1.1
subnet 172.30.2.0/24 is repeated twice in the diagram.
Thanks… fixed the figure.
Wendell
Greetings:
Thank you for creating these labs. I am getting a lot of value out of them. I am currently using CML for study practice in lieu of owning Cisco hardware. Unfortunately, when I select the link to download this lab’s CML file, it returns a web page with “error code 300 multiple choices” and offers a link to a zipped VIRL file which I am unable to run on CML.
I attempted to create the lab in CML from scratch by cutting and pasting the listed initial configurations into the “EDIT CONFIG” menus for the routers and switch. I connected the routers to the eth1 port on the desktops as that seems to be the method in other labs. However, the desktops are not picking up network info from the DHCP server.
I am not experienced with Linux. However, according to the Cisco CML community blog, the default configuration for the desktops will allow them to pick up the required network settings from a DHCP server (IP address and mask, default gateway, DNS).
I must be missing something. Maybe the desktops need a default route but can’t get it without having an IP address on the interface first. I just don’t know.
Any help would be greatly appreciated.
Tom
Hi Tom,
Glad you’re finding the labs useful.
This lab post is about five years old, and we just completed a migration of most of these posts to a revised version of each lab. Try instead this post: https://blog.certskills.com/clab125 which replaces this lab. Same flow to the lab, but there’s an updated .yaml file that should open in the current version of CML. Let me know if you try that.
Hope this helps,
Wendell
Hi Wendell,
Thank you for the quick response. I do see you recently posted updated labs which is great. Just to confirm, the link is .If so, it is coming back with “error code 404”. I did verify the links to Labs 124 and 126 are working by changing the last digit in the URI.
Tom
Tom,
Sorry about that. I looked further, and we haven’t migrated this lab to the new format yet. So…
I looked further into this lab page and found the error that was preventing you from downloading the CML file. It should work now. If not, you might try clearing your cache and reloading this page, or trying another browser for this lab. (The browser may remember that the object isn’t reachable until you clear the cache.)
Anyway, once you download the CML file, hopefully you can open it in CML and do the lab.
Wendell
Hi Wendell,
File download and lab both work perfectly!
Thank you.
Regards,
Tom