Courseiva
DHCPInterface Config

ip address dhcp

Configures a router interface to obtain an IP address dynamically from a DHCP server, typically used on LAN interfaces connecting to networks with DHCP services.

Definition: ip address dhcp is a Cisco IOS interface config command. Configures a router interface to obtain an IP address dynamically from a DHCP server, typically used on LAN interfaces connecting to networks with DHCP services.

Overview

The `ip address dhcp` command is a fundamental IOS interface configuration command that instructs a Cisco router interface to dynamically obtain its IPv4 address from a DHCP (Dynamic Host Configuration Protocol) server. This command is typically used on LAN interfaces that connect to networks where a DHCP server is present, such as enterprise access networks, home office routers, or branch office connections to an ISP. By leveraging DHCP, network administrators can simplify IP address management, reduce manual configuration errors, and support dynamic environments where devices frequently connect and disconnect.

The command is often paired with `ip dhcp client` commands to customize client behavior, such as requesting specific options or setting the client ID. From a networking concept perspective, DHCP operates on a client-server model using UDP ports 67 (server) and 68 (client). The client broadcasts a DHCPDISCOVER message, the server responds with a DHCPOFFER, the client requests the offered address with a DHCPREQUEST, and the server acknowledges with a DHCPACK.

The `ip address dhcp` command triggers this four-step process on the interface. This command is preferred over static IP assignment when flexibility and ease of management are priorities, such as in networks with many endpoints or when the IP addressing scheme may change. It is also commonly used on WAN interfaces connecting to service providers that assign IP addresses via DHCP.

In a troubleshooting workflow, verifying DHCP-assigned addresses is a critical step when diagnosing connectivity issues; the `show ip interface` or `show dhcp lease` commands reveal the assigned address, lease duration, and DHCP server details. Important IOS behaviors include: the command is available in global configuration mode under interface configuration; it requires privilege level 15 (enable mode) to configure; the running configuration will show the command, but the actual assigned IP address is not stored in the configuration (it is learned dynamically); if the interface is shut down or the DHCP lease expires, the address is released; and the command can be removed with `no ip address dhcp`. The command also supports optional parameters like `dhcp-client` to specify a client ID or hostname, though these are less commonly used.

Overall, `ip address dhcp` is a versatile tool for dynamic IP assignment in Cisco networks, balancing simplicity with robust DHCP protocol support.

Syntax·Interface Config
ip address dhcp

When to Use This Command

  • Assigning an IP address to a router's LAN interface from a corporate DHCP server to simplify management.
  • Obtaining a public IP address on a customer edge router from an ISP's DHCP server.
  • Quickly bringing up an interface for testing without manual IP configuration.
  • Deploying routers in remote offices where DHCP is used for IP assignment.

Parameters

ParameterSyntaxDescription
dhcpdhcpKeyword that enables DHCP client functionality on the interface. No additional parameters are required; the router will broadcast DHCPDISCOVER messages to obtain an IP address, subnet mask, default gateway, and DNS server from a DHCP server. Common mistakes include forgetting to configure the interface with `no shutdown` before issuing this command, or not ensuring that the interface is in a VLAN or network segment where a DHCP server is reachable.

Command Examples

Basic DHCP client configuration on GigabitEthernet0/0

interface GigabitEthernet0/0 ip address dhcp
GigabitEthernet0/0 up, line protocol is up
  Hardware is CN Gigabit Ethernet, address is 0011.2233.4455 (bia 0011.2233.4455)
  Internet address is 192.168.1.100/24
  MTU 1500 bytes, BW 1000000 Kbit/sec, DLY 10 usec,
     reliability 255/255, txload 1/255, rxload 1/255

The output shows the interface is up and has obtained IP address 192.168.1.100 with subnet mask /24. The MAC address is 0011.2233.4455. MTU, bandwidth, delay, and load values are default.

Verifying DHCP lease with show ip interface brief

show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0         192.168.1.100   YES DHCP   up                    up
GigabitEthernet0/1         unassigned      YES unset  administratively down down

The output lists all interfaces. For GigabitEthernet0/0, the IP address is 192.168.1.100, method is DHCP, and both status and protocol are up, indicating a successful lease.

Understanding the Output

When you configure 'ip address dhcp' on an interface, the router acts as a DHCP client. Use 'show ip interface brief' to see the assigned IP address and method (DHCP). The 'Internet address' line in 'show interfaces' shows the IP and subnet mask.

If the interface fails to obtain an address, it will remain 'unassigned' or show '0.0.0.0'. Check 'show dhcp lease' for lease details like server IP, lease time, and renewal timer. A healthy lease shows a valid IP and remaining time.

Watch for 'DHCP' in the method column; if it says 'manual' or 'unset', the command may not have been applied correctly.

Configuration Scenarios

Configure a Branch Router LAN Interface to Obtain IP via DHCP from ISP

A branch office router (R1) connects to an ISP via its GigabitEthernet0/0 interface. The ISP uses DHCP to assign a public IP address to the customer premises equipment. The goal is to configure R1's WAN interface to dynamically receive an IP address from the ISP's DHCP server.

Topology

R1(Gi0/0)---ISP DHCP Server R1 Gi0/0: 192.0.2.10/24 (assigned via DHCP)

Steps

  1. 1.Step 1: Enter global configuration mode: R1# configure terminal
  2. 2.Step 2: Enter interface configuration mode for GigabitEthernet0/0: R1(config)# interface GigabitEthernet0/0
  3. 3.Step 3: Enable the interface (if not already): R1(config-if)# no shutdown
  4. 4.Step 4: Configure the interface to obtain an IP address via DHCP: R1(config-if)# ip address dhcp
  5. 5.Step 5: Exit configuration mode: R1(config-if)# end
  6. 6.Step 6: Verify the assigned IP address: R1# show ip interface brief
Configuration
! Full IOS config block
interface GigabitEthernet0/0
 no shutdown
 ip address dhcp
end

Verify: Use `show ip interface brief` to verify that the interface has an IP address (e.g., 192.0.2.10) and status is up/up. Also use `show dhcp lease` to see the lease details, including the assigned IP, subnet mask, default gateway, and lease expiration.

Watch out: A common mistake is forgetting to configure the interface with `no shutdown` before applying the `ip address dhcp` command. If the interface is administratively down, the DHCP process will not start, and the interface will remain without an IP address.

Configure a Router LAN Interface to Obtain IP from Internal DHCP Server

An enterprise network has an internal DHCP server (10.0.0.1) that assigns IP addresses to devices in the 10.0.1.0/24 subnet. A new router (R2) is added to the network, and its GigabitEthernet0/1 interface connects to the internal LAN. The goal is to configure R2's LAN interface to obtain an IP address from the internal DHCP server.

Topology

R2(Gi0/1)---Switch---DHCP Server (10.0.0.1) R2 Gi0/1: 10.0.1.100/24 (assigned via DHCP)

Steps

  1. 1.Step 1: Enter global configuration mode: R2# configure terminal
  2. 2.Step 2: Enter interface configuration mode for GigabitEthernet0/1: R2(config)# interface GigabitEthernet0/1
  3. 3.Step 3: Enable the interface: R2(config-if)# no shutdown
  4. 4.Step 4: Configure the interface to obtain an IP address via DHCP: R2(config-if)# ip address dhcp
  5. 5.Step 5: Optionally, set a client ID to help the DHCP server identify the router: R2(config-if)# ip dhcp client client-id ascii R2-LAN
  6. 6.Step 6: Exit configuration mode: R2(config-if)# end
  7. 7.Step 7: Verify the assigned IP address: R2# show ip interface brief
Configuration
! Full IOS config block
interface GigabitEthernet0/1
 no shutdown
 ip address dhcp
 ip dhcp client client-id ascii R2-LAN
end

Verify: Use `show ip interface brief` to confirm the interface has an IP address (e.g., 10.0.1.100). Use `show dhcp lease` to view the lease details, including the DHCP server IP (10.0.0.1) and lease duration. Also use `debug ip dhcp client events` to monitor the DHCP negotiation process.

Watch out: A common mistake is not ensuring that the DHCP server is reachable from the interface's subnet. If the interface is in a different VLAN or subnet without a DHCP relay, the DHCP broadcast will not reach the server. Additionally, using a duplicate client ID can cause the DHCP server to assign the same IP to multiple devices, leading to conflicts.

Troubleshooting with This Command

When troubleshooting DHCP client issues on a Cisco router interface, the `ip address dhcp` command is often the starting point, but the real diagnostic work involves verifying that the DHCP process completed successfully. A healthy output from `show ip interface brief` will show the interface with an IP address and status up/up. The `show dhcp lease` command provides critical details: it displays the assigned IP address, subnet mask, default gateway (option 3), DNS servers (option 6), lease start and expiration times, and the DHCP server identifier.

A healthy lease shows a valid IP, a future expiration time, and a server IP that is reachable. Problem indicators include: the interface showing 'unassigned' or '0.0.0.0' in `show ip interface brief`; `show dhcp lease` returning nothing or showing 'No DHCP leases'; or the lease showing an IP address but with a past expiration time. Common symptoms that this command helps diagnose include: the interface failing to obtain an IP (often due to no DHCP server reachable, incorrect VLAN configuration, or interface being shut down); obtaining an IP but losing connectivity (due to lease expiration or DHCP server issues); or obtaining an incorrect IP (e.g., from a rogue DHCP server).

A step-by-step diagnostic flow a network engineer would follow: 1) Verify interface status with `show interfaces` – ensure it is up/up and not error-disabled. 2) Check if the interface has an IP with `show ip interface brief`. If no IP, verify that `ip address dhcp` is configured with `show running-config interface`. 3) Use `show dhcp lease` to see if any lease was obtained. If no lease, check for DHCP server reachability: ensure the interface is in the correct VLAN and that a DHCP server exists on that subnet or a DHCP relay is configured. 4) Use `debug ip dhcp client events` to see real-time DHCP messages.

Look for DISCOVER, OFFER, REQUEST, ACK sequence. If only DISCOVER is sent, the server may not be responding. 5) Check for ACLs or port security that might block DHCP traffic (UDP 67/68). 6) If a lease is obtained but connectivity fails, verify the default gateway from `show dhcp lease` and ensure the router has a route to that gateway. Correlating with other commands: `show ip route` can reveal if the default route is learned via DHCP (a default route with next-hop as the DHCP gateway). `show arp` can show if the DHCP server's MAC address is resolved. `ping` from the router to the DHCP server tests reachability.

In summary, systematic use of `show dhcp lease`, `debug ip dhcp client`, and interface verification commands isolates DHCP issues efficiently.

CCNA Exam Tips

1.

Remember that 'ip address dhcp' is configured in interface configuration mode, not global config.

2.

The router will send a DHCP discover broadcast; ensure the interface is not shutdown.

3.

Use 'show dhcp lease' to verify the obtained IP and lease details; exam may ask about lease renewal.

4.

If the interface is up but no IP is assigned, check that a DHCP server is reachable on that subnet.

Common Mistakes

Applying 'ip address dhcp' in global configuration mode instead of interface mode, causing a syntax error.

Forgetting to enable the interface with 'no shutdown' before or after the command.

Assuming the router will get the same IP every time; DHCP leases are dynamic unless reserved.

ip address dhcp vs ip address [ip] [mask]

Both commands configure an IPv4 address on an interface, but they differ fundamentally in how the address is obtained. 'ip address dhcp' relies on a DHCP server to lease an address dynamically, while 'ip address [ip] [mask]' assigns a fixed, static address. They are often compared when deciding between dynamic and static addressing for router interfaces.

Aspectip address dhcpip address [ip] [mask]
IP AssignmentDynamic (DHCP lease)Static (manual entry)
PersistenceLease renewal, may change on reloadPermanent until changed
DependencyRequires DHCP server on networkNo external dependency
ConfigurationSingle command, no address neededRequires explicit IP and mask
Typical useClient-facing LAN interfacesNetwork infrastructure links
PrecedenceCannot coexist with static ip address on same interfaceCannot coexist with dhcp

Use ip address dhcp when the router interface needs to obtain an IP address automatically from a DHCP server, such as on a customer-facing LAN segment.

Use ip address [ip] [mask] when a static, deterministic IP address is required for the interface, e.g., on point-to-point links or infrastructure interfaces.

Platform Notes

In IOS-XE (e.g., Catalyst 9000 switches, ISR 4000 series), the `ip address dhcp` command syntax and behavior are identical to classic IOS. However, IOS-XE may support additional DHCP client options like `ip dhcp client request` to request specific options. The output of `show dhcp lease` is similar but may include additional fields like 'Client-ID' or 'Hostname'.

In NX-OS (Cisco Nexus switches), the equivalent command is `ip address dhcp` under interface configuration mode, but NX-OS uses a different DHCP client implementation. For example, on Nexus 9000 series, the command is `ip address dhcp` and verification uses `show ip dhcp lease` or `show ip interface`. NX-OS also supports `ip dhcp client` subcommands like `client-id` and `hostname`.

On Cisco ASA firewalls, DHCP client functionality is configured differently: use `ip address dhcp` under interface configuration mode, but the ASA also requires `dhcpd` commands for server functionality. The ASA's DHCP client is similar to IOS but has its own verification commands like `show dhcpd` and `show ip address`. In IOS-XR (Cisco ASR 9000, NCS 5500), the `ip address dhcp` command is not supported; instead, IOS-XR uses a different DHCP client configuration via `dhcp ipv4` under interface configuration, with commands like `dhcp ipv4 client` and `dhcp ipv4 enable`.

The verification commands are `show dhcp ipv4 client` and `show ipv4 interface`. Behavior differences across IOS versions: In IOS 12.x, the DHCP client is less robust and may not support all options; in 15.x and 16.x, the client is more feature-rich, including support for DHCP option 12 (hostname) and option 61 (client ID). The `ip address dhcp` command itself has remained consistent, but the underlying DHCP client code has improved over time.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with practice questions covering all CCNA 200-301 exam domains.

Practice CCNA 200-301 Questions