IOS DHCP Server Config – Answers
Can you configure an IOS DHCP server from memory? Set up the DHCP pools, configure the correct subnet and mask, define the default gateway and DNS addresses, and exclude IP addresses as needed? And not add any extra or meaningless commands? Those are some of the requirements to get this latest practice question correct. Read and answer the question on your own first, and then read this post for the explanation.
The Answers:
A, C
The Dilemma of Answers A and B: Which network Command?
Two answers offered options for the network command in DHCP pool mode:
network 172.16.2.0 /24
network 172.16.2.128 /25
The two options compete, and you would need at most one of the two. The first option matches all addresses in the subnet (subnet 172.16.2.0/24), while the other matches all addresses in the upper half of the subnet (address 172.16.2.128 – 172.16.2.255). Both concepts exist in the question: The entire subnet, and the design goal of assigning addresses from the upper half of the subnet only. Basically, part 1 of this question makes you consider:
which network command works for that requirement?
Figure 1: The Network for the DHCP Server Question
The Dilemma of Answers C and D: Excluding the Router’s Address?
Answers C and D create a second dilemma, so that you would again choose at most one of the two answers. These answers basically ask whether the IOS DHCP server configuration must exclude the router’s IP address.
First, used loosely, the term “exclude” means that the DHCP server would not offer the address to a DHCP client. More specifically, the term “exclude” can refer to addresses configured with the ip dhcp excluded-address command so that the DHCP server does not offer to lease the address. Clearly, any statically-configured IP addresses in a subnet, like the pre-configured static IP address of the router or switch in the subnet, should be excluded. However, in this case:
- Does the definition of R2 as the default gateway in the subnet, with the default-router 172.16.2.1 command in DHCP pool mode, already cause the DHCP server to exclude the address? That is, do you need to configure the default router’s address in an ip dhcp excluded-address command?
- If you chose the network 172.16.2.128 /25 command (answer B), which implies a range from 172.16.2.128 – 172.16.2.255, would you need to then exclude the router’s IP address of 172.16.2.1, which isn’t even in that range?
Two Key Facts: Correct Mask and Exclude the Router Address
The CCENT EPL video 9.3 I mentioned in the question post (available free as a preview) speaks to both these points. The shorter version:
Use the correct subnet mask in the IOS DHCP configuration for proper DHCP server operation. That is, use the same mask used in the actual subnet. That’s because of how the DHCP Discover message’s source IP address helps the IOS DHCP server identify the IOS DHCP Server’s pool to use.
For instance, with answer B in this case, DHCP requests from subnet 172.16.2.0 would arrive at the IOS DHCP server on R1 with a source IP address of 172.16.2.1. R1’s configuration with the /25 mask would not include address 172.16.2.1 in its range. So, the IOS DHCP server would not match that request to the pool and would not service that request. However, answer A’s network 172.16.2.0 /24 command, which implies a range from 172.16.2.0 – 172.16.2.255, would include address 172.16.2.1, so the DHCP server would see the source address of the request in the DHCP pool, identify the correct pool, and service the request.
Exclude R2’s IP address using a command. The IOS DHCP server does not automatically exclude the IP address of the default router, even with the configuration of the default-router 172.16.2.1 command in this case. The configuration should exclude it using the ip dhcp excluded-address command. (That makes answer C correct, and answer D incorrect.)
Perspective: A Complete Configuration
Just to complete the discussion, consider this completed IOS DHCP server config for router R1.
ip dhcp excluded-address 172.16.2.1 172.16.2.127 ! ip dhcp pool swimming network 172.16.2.0 /24 dns-server 172.16.1.10 default-router 172.16.2.1
R1’s DHCP Server Configuration to Support Subnet 172.16.2.0/24
Note that the IOS DHCP server never assigns the subnet ID nor subnet broadcast address, so these addresses do not need to be listed in ip dhcp excluded-address commands. The configuration then reserves the rest of the lower half of the address range, leaving 172.16.2.128 – 172.16.2.254 available for lease by the DHCP server. Figure 2 shows the idea visually.
Figure 2: R1’s DHCP Server Configuration to Support Subnet 172.16.2.0/24
There is a mistake with the numbering of the routers. 172.16.2.1 belongs to R2, not R1.
Agree – and fixed. thanks for the heads up.
Hi Wendell,
I keep going this over and over again and think that I must be going crazy. Hoping you can shed some light on this for me…
I chose answer D as the only viable answer originally.
I am confused by your answers for a few reasons.
Answer A: I can accept this as correct if you are not meaning for us to choose the literal commands to be entered on the router. As the router will only accept a full mask and not prefix notation. Was this your intention? If so that’s very sneaky but Cisco does do this also to catch us off guard!
Answer C: The ip dhcp excluded-address command(s) must exclude the address of router R1 (and possibly others) — Why would a DHCP pool for a 172.16.2.0 /24 network need to exclude an address in the range of another subnet? (172.16.1.0 /24) ? This is the most confusing part to me…
I ran this up in packet tracer also before the answer was released and was able to have it all working with the following config.
This is a full setup, so more commands than you wanted, but I did not need to exclude any addresses from R1…
R1 config
ip dhcp excluded-address 172.16.2.1 172.16.2.128
ip dhcp pool POOL1
network 172.16.2.0 255.255.255.0 (not /24)
default-router 172.16.2.1
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0 (needed to send DHCP packets back to R2 LAN as there are no routing protocols used)
R2 config
interface GigabitEthernet0/1 (connected to R1)
ip address 172.16.2.1.255.255.255.0
ip helpder-address 10.1.1.254 (network between R1 and R2)
With this configuration no lower half numbered IPs are handed out, only upper half as you wanted.
Hi Michael,
First off, my touch of dyslexia got the best of me. The IOS HDSP server is on router R1, and the subnet supported by that server is off R2, with R2 as default gateway. I mis-referenced in the question and answer posts, so I’m sure that’s most of the cause of your confusion.
Short version, R2 is the default gateway for the subnet in question.
So, I changed the question and answer post, making answers C and D reference R2 as the default router. I think that clears up your comments/questions about answers C and D?
On answer A/B, note that both answers are syntactically correct. The IOS DHCP network command will accept either a prefix-style mask or a dotted-decimal mask.
Feel free to follow up if the fixes didn’t make it clearer. Sorry for the mistake.
Wendell
old post, but I’m trying to study for the CCNA and beyond.
that being said this sort of topic would it be on the CCNA?
Hi Chris,
DHCP Server is not mentioned in the CCNA 200-301 V1.0 blueprint, which is the current blueprint. So, short version is no.
More generally, this blog has plenty of posts that I wrote for prior versions of CCNA, and some of those are not mentioned in the current CCNA blueprint. So don’t use the blog as a gauge for what’s in/out – use the CCNA blueprint (aka the CCNA exam topics.) Or my books, which is my interpretation of the blueprint in excruciating detail. 🙂