DHCP Client on Cisco IOS

This topic is to discuss the following lesson:

https://networklessons.com/cisco/ccie-routing-switching/dhcp-client-on-cisco-ios/

Hi Rene,

Not clear about the default static route when configuring Router as DHCP client. It will autometically installed in Routing table & why the AD value will be 254 ??Thanks for your so nice cooperation as always.

br//
zaman

Mohammad,
The Administrative Distance is so high because it is deemed to be the least reliable method of routing. With an AD of 254, a default route introduced by any routing protocol, or any default route manually entered, will take precedence. Think of the DHCP supplied default route as a “default route of last resort.”

Awesome.
It was my first configuration.
i m very thankful to you.
your explanation is amazing.

The IOS I’m using in GNS3 does have the ip dhcp pool command. It unfortunately does not have the ip address dhcp command.

It is probably a too old IOS ?

Hello Maodo

Hmmm that’s interesting. According to Cisco, the ip address dhcp command was added to the 12.1(2)T version of IOS. What IOS version are you using?

Laz

Hello Laz,

I will have to add my 2 cents on this. I work with different Cisco devices everyday and sometime I will be supporting a supervisor linecard which doesn’t have ip add dhcp command feature on it regardless of their version. Also some cisco ASA don’t have this command

Hello sales2161

This does seem to happen sometimes, where commands are unavailable on some IOS versions when they should be there. Sometimes on GNS3, sometimes on real equipment. The best thing to do in such situations is to visit the Cisco Feature Navigator which is the go-to source for all IOS information. There you will find which features are available from which IOS versions from the horse’s mouth so to speak.

I hope this has been helpful!

Laz

Hi Lazaros,
Does client act as a host computer or as a router?

Hello,
Can you clarify more on your question?

Hello Muhammad

A DHCP client can be any device that can obtain an IP address via DHCP. This could be a computer, it could be an interface on a router (as in the lesson). Specifically for Cisco IOS routers, you can configure a router as a DHCP server, and you can also configure any interface of a router as a DHCP client.

I hope this has been helpful!

Laz

try the CCENT tomorrow morning and I made the test that you propose.

at question 45, I had the choice between
ip dhcp MYPOOL pool
network 192.168.1.1 255.255.255.0

and
ip dhcp MYPOOL pool
network 192.168.1.0 / 24

as all IOS accept “network subnet subnet-mask” and only some recent bones accept “network subnet prefix-length”, I chose “network 192.168.1.1 255.255.255.0”
but the answer of your test indicates as good answer “network 192.168.1.0 / 24”, alas!

however, in packet tracer, “network 192.168.1.1 255.255.255.0” neither “network 192.168.1.10 255.255.255.0” nor “network 192.168.1.1OO 255.255.255.0” generates an error message (and I am convinced of the have seen on an installation script of a client equipment) and, mathematically, the 3 instructions identify the same subnet.

Can you confirm that “network subnet prefix-length” is a Cisco best practice, and that “network subnet subnet-mask” is deprecated?

Hello Hugues

In the question you are referring to, it is true that the subnet mask can be used for all IOS versions while the the “slash” format can be used only in some newer versions of IOS. And it is true that the DHCP command will accept any IP address within the range (not only the network address) to successfully configure DHCP. Yes, the device will accept other IP addresses, however, the most correct answer is indeed the one that uses the network address, which is 192.168.1.0 because this is how we define network address ranges for DHCP.

Even so, for clarity, the question has been adjusted to be clearer so such discrepancies will not cause problems.

As far as I know, in most new IOS, both the slash and the mask syntax are acceptable, and there is no best practice for which to use, and neither is there a deprecation of the subnet mask version of the command.

I hope this has been helpful!

Laz

Hello All,
i would like to test something
i have a setup like this


is there any way to check if my dhcp assignment works fine if i do not have any other available physical interface to test other than the ones you see in the image ?
can i assign an ip from the dhcp server(that dhcp is not in the same subnet) to a virtual interface like loopback or svi ?
connectivity and dhcp snooping configuration it works as expected.

Hello @xpouliou92 ,

You have some different options here. You could use an SVI on a switch:

SW1(config)#interface vlan 120
SW1(config-if)#ip address dhcp

If you use a multilayer switch, you can convert a switchport into a L3 port and enable DHCP client:

SW1(config)#interface GigabitEthernet 1/0/21
SW1(config-if)#no switchport
SW1(config-if)#ip address dhcp

If you use VLANs and have a router, you could use a sub-interface:

R1(config)#interface GigabitEthernet 0/1
R1(config)#interface GigabitEthernet 0/1.10
R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#ip address dhcp

I hope this helps!

Rene