Local DHCP Server 1

certskills
By certskills April 13, 2016 09:05

Configuring a local DHCP server on a router removes the need for one DHCP configuration feature, but you still need to navigate all the DHCP server features. Today’s lab gives you a chance to practice. Follow the usual drill – and if you have a place to test, do it, and make sure the clients do indeed lease an IP address!

Requirements

Configure a DHCP server on R1 for the subnets that reside in VLANs 10 and 20. and VLANs. In particular:

  • 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 10.1.1.1 and 10.1.1.2
  • Set the domain name for the network to example.com.
  • Set the lease length to 7 days long.
  • Prevent the server from assigning R1’s IP addresses to clients for the subnets supported by the DHCP server.
  • Assume all router interfaces shown in the lab are up and working.
  • Assume that the ROAS configuration of R1 is correct.
  • Assume that SW1 has correctly configured trunks and VLANs for all interfaces.

 

Figure 1: ROAS with two VLAN’s (CL124.jpg)

Initial Configuration

Example 1, 2, 3, and 4 show the beginning configuration state of R1, R2, R3 and SW1.

Example 1: R1 Config

Example 2: SW1 Config

 

Answer on Paper, or Maybe Test in Lab

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 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 whether the switch obtained its address.

 

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.

This lab’s CML file!

Download this lab’s VIRL file!

The .VIRL topology matches the 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 Set for DHCP cisco/cisco
PC2 Set for 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
To release current IP address: sudo dhclient -r eth1
To acquire new IP address: sudo dhclient -v eth1 (-v = verbose, shows address request)

 

EIGRP for IPv6 1
Answers: Local DHCP Server 1
certskills
By certskills April 13, 2016 09:05
Write a comment

6 Comments

  1. Mikhail September 2, 03:01

    Wendell, hello again!
    First of all, i want to mention, that i am not a native english speaker.
    I am struggeling with one problem i cant understand. Just imagine this situation:
    We have only one DHCP server (router) and one dhcp client, connected straight to each other.
    Router has such config:

    int fa0/0
    ip address 192.168.1.1 255.255.255.0
    no shutdown
    ip dhcp pool name
    network 192.168.2(sic).0 255.255.255.0
    default-router 192.168.2.1

    With such config host will never recieve its network configuratons. But i am wondering why? How does differenses between int fa0/0 ip address and dhcp network config influence on the “DORA” communication?
    I understand, that i should either change dhcp network to 192.168.1.0 255.255.255.0 or change fa0/0 ip address to 192.168.2.1 255.255.255.0
    But still, why?

    Reply to this comment
    • CCENTSkills September 7, 10:07

      Hi Mikhail,
      Good to hear from you. Your english is wonderful, by the way!
      To answer your question, let me start with one. Would you agree that the DHCP client, sitting on the same LAN as the router’s F0/0 interface, should have an IP address in subnet 192.168.1.0/24? That’s the main reason why the pool then should list network 192.168.1.0/24 in the DHCP pool. That’s the motivation. Hosts in a subnet should be in the same subnet as the other hosts on the same LAN/VLAN and in the same subnet as the routers connected to the same LAN/VLAN. So that DHCP client needs to be assigned an address in subnet 192.168.1.0/24 in this case, so you need a pool that includes that network.

      As to why the config you listed fails:
      Client sends the Discover
      Arrives at router’s F0/0 interface
      Router changes source IP address to router’s own 192.168.1.1 address
      Router processes DHCP request, noting the source IP address, which identifies the source subnet, compares that address to the DHCP server’s network commands. NONE MATCH. So it makes no DHCP reply.

      I think that last bit may be what you were asking?
      Wendell

      Reply to this comment
  2. Jacob Egeler July 12, 11:50

    Hello,

    This example does not seem relevant to Chapter 7 in your latest book for CCNA 200-301 Volume 2. Chapter 7 never mentions how to configure DHCP Server on the router, while it is cool to know. I looked at the question and was confused for a second thinking to myself “did we cover this?”.

    Reply to this comment
    • certskills Author July 14, 09:34

      Hi Jacob,
      Yep, you’re right. It was in the previous CCNA Exam Blueprint, but not in the 200-301 exam blueprint. I’ll look at adding this one to the legacy list of labs… but it’s also useful. Maybe I’ll just add a note about it being out of scope but still interesting.
      Wendell

      Reply to this comment
  3. Cbastoro March 1, 17:16

    Hi Wendell,
    At the end of the lab I look foward that both PC1 and PC2 are asssigned them correctly IP addresses according to each DHCP pool, but not success for PC1 due to DHCP failed. APIPA is being used.
    What is this type of error due to?

    Reply to this comment
    • Chris April 6, 10:06

      Hello Cbastoro
      We tried the config in CML2 and in PKT 8. Worked as expected. I notice that the file here is the older VIRL type file. What option were you using to test this lab ?

      Reply to this comment
View comments

Write a comment

Comment; Identify w/ Social Media or Email

Search

Categories