How to configure a router Ethernet interface or Switch Virtual Interface (SVI) to be a DHCP client?
This is especially useful on Ethernet interfaces which act as WAN interface that dynamically connects to an Internet Service Provider (ISP).
Once assigned a dynamic address, the interface can be used with the Port Address Translation (PAT) of Cisco IOS Network Address Translation (NAT) to provide Internet access to a privately-addressed network attached to the router.
The VLAN assigned to the router interface should accept the dynamic IP address.
To acquire an IP address on an interface from the Dynamic Host Configuration Protocol (DHCP), issue the ip address dhcp command in interface configuration mode.
This is usually configured on an Ethernet interface or Switch Virtual Interface (SVI) or interface VLAN.
Configure this on the VLAN interface:
#config t #int vlan x #ip address dhcp
Configure this on the Ethernet interface:
#config t #interface Ethernet x #ip address dhcp Here, x is the interface number.
Note: a default route will automatically be added by DHCP with metric of 254. If the default gateway is not supplied by the ISP, then add the following default route:
#ip route 0.0.0.0 0.0.0.0 dhcp
Example Configuring the DHCP Client
Topology Showing a DHCP Client with a Ethernet Interface
On the DHCP server, the configuration is as follows:
ip dhcp pool 1 network 10.1.1.0 255.255.255.0 lease 1 6 On the DHCP client, the configuration is as follows on interface E2: interface Ethernet2 ip address dhcp
This configuration allows the DHCP client to acquire an IP address from the DHCP server through an Ethernet interface.