Cisco routers can be configure as both DHCP servers and DHCP clients. An interface on a router that connects to the Internet Service Provider (ISP) is often configured as a DHCP client. This way, the ISP can provide the IP information to the client device.
To configure an interface as a DHCP client, the ip address dhcp interface mode command is used. Consider the following example:
We have a small network consisting of a router and a DHCP server. We want to configure the interface Gi0/0 on the router as a DHCP client. This is how this is done:
R1(config)#int Gi0/0 R1(config-if)#ip address dhcp
We can verify that the Gi0/0 interface has indeed got its IP address from the DHCP server by running the show ip int brief command:
R1#show ip int brief Interface IP-Address OK? Method Status Protocol GigabitEthernet0/0 192.168.0.1 YES DHCP up up GigabitEthernet0/1 unassigned YES unset administratively down down
The DHCP keyword in the method column indicates that the IP information were obtained by the DHCP server.