Using DHCP to Dynamically Configure Router IP Addresses
Problem
You want the router to obtain its IP addressing information dynamically.
Solution
The ip address dhcp configuration command allows the router to obtain the address information for an interface dynamically:
Router1#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router1(config)#interfaceRouter1(config-if)#FastEthernet0/1ip address dhcpRouter1(config-if)#endRouter1# Interface FastEthernet0/1 assigned DHCP address 172.25.1.57, mask 255.255.255.0 Router1#
Tip
Prior to Release 12.2(8)T, the ip address dhcp command was only supported on Ethernet interfaces.
Discussion
Cisco started to include DHCP client functionality in IOS Version 12.1(2)T. This allows routers to obtain interface IP address information via DHCP. While we don’t recommend using dynamic addressing for routers in an internal network, this can be extremely useful for routers that connect to the Internet through an ISP. It is increasingly common for service providers to use DHCP to give address information to allocate information to client devices.
When an interface on the router is configured as a DHCP client like this, it is able to dynamically learn its IP address, and netmask, via DHCP. In addition, the router also learns its TFTP server address, NETBIOS nameserver, vendor-specific information, static routes, domain name, DNS servers, and default router information.
Beginning with IOS Version 12.3(8)T, you can control which options ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access