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.
This is the topology we will use:
Let’s start with the 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.
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:
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.
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.”
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 ?
Hmmm that’s interesting. According to Cisco, the
ip address dhcpcommand was added to the 12.1(2)T version of IOS. What IOS version are you using?