Lesson Contents
DHCP server is often used on Cisco IOS routers so you supply hosts with an IP address. We can also use DHCP client on our routers which is useful if your ISP uses dynamic IP addresses for customers.
In this lesson, we’ll take a look how to configure your router as DHCP client.
Configuration
This is the topology we will use:
Let’s start with the DHCP server.
DHCP Server
Let’s create a pool for our local subnet and include a default route:
Server(config)#ip dhcp pool MY_POOL
Server(dhcp-config)#network 192.168.1.0 /24
Server(dhcp-config)#default-router 192.168.1.254
That’s all we need, let’s look at the DHCP client now.
DHCP Client
You only need one command on the interface to use DHCP:
Client(config)#interface FastEthernet 0/0
Client(config-if)#ip address dhcp
Client(config-if)#no shutdown
After a few seconds you will see this:
Client#
%DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 192.168.1.1, mask 255.255.255.0, hostname Client
Great so we got an IP address:
Client#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.1.1 YES DHCP up up
The router also installs a default route:
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 ?
Hi Lazaros,
Does client act as a host computer or as a router?
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” no
... Continue reading in our forumHello 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 c
... Continue reading in our forum