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: