How to Configure Router as DHCPv4 Client
In some cases, we need a router to be configured as DHCPv4 clients just like a client computer. But this method is not recommended for routers in an internal network. The dynamic addressing is extremely useful for routers that connect to the Internet through an ISP.
We can simply connect a router using with just plug-in the Ethernet cable. To configure an Ethernet interface as a DHCPv4 client we use the ip address dhcp command in interface configuration mode.
When an interface on the router is configured with ip address dhcp command, it can dynamically learn its IP address, and network mask, via DHCP. The router can also learn its TFTP server address, NETBIOS name server, DNS servers, vendor-specific information, static routes, domain name, and default router information.
Configuration
The Figure below contains the topology including DHCPSERVER and Client. You may suppose that the DHCPSEVER is an ISP server configured to provide DHCP service to clients with IP addresses from the selected of 192.168.1.2 – 192.168.1.100.
After the Fa0/0 interface of the client, the router is configured with the ip address dhcp command, We can verify the configuration using the show ip interface fa0/0 command confirms that the interface is up and that the address was allocated by a DHCPv4 server. Now lets come to the configuration:
DHCP Server Configuration
- server(config)#ip dhcp excluded-address 192.168.1.1
- server(config)#ip dhcp pool My-pool
- server(dhcp-config)#network 192.168.1.0 255.255.255.0
- server(dhcp-config)#default-router 192.168.1.1
- server(dhcp-config)#exit
- server(config)#
DHCP Client Configuration
- client(config)#interface fastEthernet 0/0
- client(config-if)#ip address dhcp
- client(config-if)#exit
- client(config)#
Now check and verify that the address configuration using the show ip interface fa0/0 command. The figure below illustrates the output of this command.