default-router [ip]
Specifies the default gateway IP address to be assigned to DHCP clients in a DHCP pool configuration.
Definition: default-router [ip] is a Cisco IOS dhcp pool config command. Specifies the default gateway IP address to be assigned to DHCP clients in a DHCP pool configuration.
Overview
The `default-router` command is used in DHCP pool configuration mode on Cisco IOS devices to specify the default gateway IP address that will be assigned to DHCP clients. This command is critical for enabling clients to communicate outside their local subnet, as the default gateway is the router that forwards traffic to other networks. Without a properly configured default-router, DHCP clients may receive an IP address but cannot reach the internet or other subnets.
The command is part of the DHCP server feature set, which allows a Cisco router to act as a DHCP server for clients on a specific interface or VLAN. The networking concept behind this is the default gateway, which is the first hop router that clients use to send packets to destinations not on the local network. In a typical enterprise network, the default gateway is often the router interface that serves as the Layer 3 gateway for the subnet.
When configuring a DHCP pool, you must specify at least one default-router IP address; you can specify up to eight addresses for redundancy. Alternatives to this command include using a separate DHCP server (e.g., Windows Server, ISC DHCP) or configuring static IP addresses on clients, but the `default-router` command is the standard way to provide dynamic gateway assignment in a Cisco IOS DHCP server. In the broader network configuration workflow, after creating a DHCP pool and specifying the network/subnet, you typically add the default-router, DNS servers, and lease time.
Troubleshooting often involves verifying that the default-router is correctly configured and reachable from the client subnet. Important IOS behavior: the command is available in DHCP pool configuration mode (entered via `ip dhcp pool <name>`). It does not require any special privilege level beyond privileged EXEC (enable).
The configuration is stored in the running config and can be saved to startup config. If multiple default routers are specified, the client will receive them in the order listed, but the client's operating system determines which one to use (usually the first). The command does not affect the router's own routing table; it only influences the DHCP offer sent to clients.
A common mistake is to forget to configure the default-router, which results in clients receiving an IP address but no gateway, causing connectivity issues. Another mistake is to use an IP address that is not in the same subnet as the client network, which will cause the client to ignore the gateway or fail to route. The command can be removed with `no default-router <ip>`.
It is important to note that the default-router IP must be reachable from the client subnet; typically it is the IP address of the router interface that serves as the gateway for that subnet. In summary, the `default-router` command is a fundamental part of DHCP configuration on Cisco routers, ensuring clients have the necessary default gateway to communicate beyond their local network.
default-router [ip]When to Use This Command
- Configuring a DHCP pool for a LAN segment where clients need a default gateway to reach external networks.
- Setting up DHCP for a VLAN interface to provide clients with the router's IP as the default gateway.
- Assigning multiple default gateways for redundancy in a DHCP pool (though only one is typically used).
- Updating the default gateway in an existing DHCP pool when the router's IP changes.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| ip | A.B.C.D | The IP address of the default gateway to be assigned to DHCP clients. This must be a valid unicast IP address in the same subnet as the DHCP pool's network. Common mistakes include using an IP address outside the subnet, using a broadcast or network address, or omitting the command entirely. Up to eight default routers can be specified by repeating the command. |
Command Examples
Basic default-router configuration
default-router 192.168.1.1This command sets the default gateway for DHCP clients to 192.168.1.1. No output is displayed upon successful configuration.
Verifying default-router in DHCP pool
show ip dhcp pool LAN_POOLPool LAN_POOL : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 254 Leased addresses : 10 Pending event : none 1 subnet is currently in the pool : Current index IP address range Leased addresses 192.168.1.1 192.168.1.1 - 192.168.1.254 10 Default router : 192.168.1.1
The output shows the DHCP pool details. The 'Default router' line indicates the gateway assigned to clients. Here it is 192.168.1.1. If missing, clients would not receive a default gateway.
Understanding the Output
The 'default-router' command itself produces no output. To verify, use 'show ip dhcp pool [pool-name]'. In the output, look for the 'Default router' field.
It should list the IP address(es) configured. If the field is absent, no default gateway is being assigned, which will prevent clients from reaching outside their subnet. Ensure the IP matches the router's interface IP on that subnet.
Configuration Scenarios
Configure DHCP Pool for a Small Office Subnet
A small office has a single subnet 192.168.1.0/24. The router interface Gi0/0 has IP 192.168.1.1, which will serve as the default gateway. We need to configure a DHCP pool to assign IP addresses to clients.
Topology
Client---(Gi0/0)Router(Gi0/0)---Internet
Router interface Gi0/0: 192.168.1.1/24Steps
- 1.Step 1: Enter global configuration mode: configure terminal
- 2.Step 2: Create a DHCP pool named OFFICE: ip dhcp pool OFFICE
- 3.Step 3: Specify the network and subnet mask: network 192.168.1.0 255.255.255.0
- 4.Step 4: Set the default gateway: default-router 192.168.1.1
- 5.Step 5: Optionally set DNS server: dns-server 8.8.8.8
- 6.Step 6: Exit DHCP pool config and global config: end
- 7.Step 7: Verify with: show ip dhcp pool
! ip dhcp pool OFFICE network 192.168.1.0 255.255.255.0 default-router 192.168.1.1 dns-server 8.8.8.8 !
Verify: Use 'show ip dhcp pool' to see pool utilization and configuration. Expected output includes pool name, network, default-router, and number of active clients. Also use 'show ip dhcp binding' to see assigned IP addresses.
Watch out: Forgetting to configure the 'network' command before 'default-router' will cause the router to reject the default-router command because the pool subnet is not defined.
Configure DHCP Pool with Multiple Default Gateways for Redundancy
A branch office has two routers acting as redundant gateways (HSRP). The virtual IP 10.10.10.1 is the active gateway, but we also want to provide the physical IPs as fallback. The DHCP pool should assign the virtual IP as the primary default gateway.
Topology
Client---(Gi0/0)Router1(10.10.10.2)---(Gi0/0)Router2(10.10.10.3)
HSRP virtual IP: 10.10.10.1
Subnet: 10.10.10.0/24Steps
- 1.Step 1: Enter global configuration mode: configure terminal
- 2.Step 2: Create DHCP pool BRANCH: ip dhcp pool BRANCH
- 3.Step 3: Define the network: network 10.10.10.0 255.255.255.0
- 4.Step 4: Set multiple default routers: default-router 10.10.10.1 10.10.10.2 10.10.10.3
- 5.Step 5: Set lease time: lease 7
- 6.Step 6: Exit and save: end; write memory
- 7.Step 7: Verify with: show ip dhcp pool BRANCH
! ip dhcp pool BRANCH network 10.10.10.0 255.255.255.0 default-router 10.10.10.1 10.10.10.2 10.10.10.3 lease 7 !
Verify: Use 'show ip dhcp pool BRANCH' to confirm the default-router list. Use a packet capture or check client DHCP options to see the gateway list. Clients should receive the virtual IP as the primary gateway.
Watch out: If the HSRP virtual IP is not configured on the router, clients may receive an unreachable default gateway. Ensure the virtual IP is active and reachable.
Troubleshooting with This Command
When troubleshooting DHCP issues related to the default gateway, the first step is to verify that the `default-router` command is present in the DHCP pool configuration. Use `show running-config | section ip dhcp pool` to inspect the pool. A healthy configuration will show one or more IP addresses under the pool.
If the command is missing, clients will not receive a default gateway, causing them to be unable to communicate outside their subnet. Another common issue is an incorrect IP address, such as one that is not in the same subnet as the client network. For example, if the pool network is 192.168.1.0/24 but the default-router is set to 10.0.0.1, clients will either ignore the gateway or fail to route.
Use `show ip dhcp pool` to see the configured default-router and compare it to the subnet defined in the `network` command. Also verify that the default gateway IP is actually reachable from the client subnet; it should be the IP of a router interface that is directly connected to that subnet. If the gateway is a virtual IP (e.g., HSRP), ensure the HSRP group is active and the virtual IP is pingable from the router itself.
Use `show standby` to check HSRP status. If clients are receiving a default gateway but cannot reach the internet, check the router's routing table and NAT configuration. Use `show ip route` to confirm the router has a default route or knows how to forward traffic.
Another diagnostic step is to enable DHCP debugging with `debug ip dhcp server events` or `debug ip dhcp server packets`. This will show the DHCP offer sent to clients, including the default gateway option (option 3). Look for the 'giaddr' field and the 'option 3' value.
If the default-router is missing from the debug output, the pool configuration is incomplete. Also correlate with `show ip dhcp binding` to see which IP addresses have been assigned and to which clients. If a client reports no default gateway, check the client's DHCP lease (e.g., `ipconfig /all` on Windows) to see the gateway assigned.
If the gateway is missing, the problem is likely on the DHCP server side. If the gateway is present but unreachable, check connectivity from the client to the gateway (ping). If the gateway is a different subnet, the client may have a misconfigured subnet mask.
In summary, the key fields to focus on are the default-router IP in the pool config, the subnet defined in the network command, and the actual reachability of the gateway. A systematic approach: 1) Verify pool config, 2) Check DHCP debug, 3) Verify client lease, 4) Test connectivity from client to gateway, 5) Check router routing and HSRP if applicable.
CCNA Exam Tips
CCNA exam tip: The 'default-router' command is required for DHCP clients to have a gateway; omitting it is a common misconfiguration.
CCNA exam tip: You can only specify one default-router per DHCP pool; multiple entries are not supported in IOS.
CCNA exam tip: The IP must be in the same subnet as the network statement in the DHCP pool.
CCNA exam tip: Remember that 'default-router' is configured in DHCP config mode, not global config.
Common Mistakes
Mistake 1: Forgetting to configure 'default-router' — clients get an IP but no gateway, causing no internet access.
Mistake 2: Using an IP outside the DHCP pool's subnet — clients will ignore or reject the gateway.
Mistake 3: Typing 'default-gateway' instead of 'default-router' — the command will be rejected.
default-router [ip] vs ip dhcp pool [name]
Both commands are part of DHCP configuration on Cisco IOS routers, but they operate at different levels. The 'ip dhcp pool' command creates a DHCP pool and enters the configuration mode where DHCP parameters are defined, while 'default-router' is a specific parameter within that pool that sets the default gateway for clients. They are often confused because 'default-router' is only valid inside a DHCP pool configuration, but its effect is part of the broader pool settings.
| Aspect | default-router [ip] | ip dhcp pool [name] |
|---|---|---|
| Configuration Mode | DHCP Pool Config (entered via 'ip dhcp pool') | Global Config |
| Purpose | Sets default gateway address for DHCP clients in the pool | Creates a DHCP pool and enters pool configuration |
| Dependency | Requires an existing DHCP pool (created by 'ip dhcp pool') | Must be used before pool-specific parameters |
| Scope | Affects only the current DHCP pool | Creates a new DHCP pool context |
| Persistence | Does not persist if no pool exists in config | Persists in running config as part of DHCP pool configuration |
Use default-router [ip] when you need to specify the default gateway address for clients in an existing DHCP pool.
Use ip dhcp pool [name] when you need to create a new DHCP pool and enter its configuration mode to define subnet, gateway, DNS, and other options.
Platform Notes
On Cisco IOS-XE (e.g., Catalyst 9000 switches, ISR 4000 series), the `default-router` command syntax is identical to classic IOS. The output of `show ip dhcp pool` may include additional fields like 'Subnet size' and 'Lease time' in newer versions, but the default-router display remains the same. On NX-OS (e.g., Nexus switches), the DHCP server feature is not available by default; you must enable the `feature dhcp` command.
The equivalent command in NX-OS DHCP pool configuration mode is also `default-router <ip>`, but the configuration hierarchy is slightly different: you enter `ip dhcp pool <name>` and then `network <subnet> <mask>` and `default-router <ip>`. NX-OS also supports `ip dhcp relay` for DHCP relay, but the server feature is limited. On ASA firewalls, DHCP server configuration is done via `dhcpd address <start-ip>-<end-ip> <interface>` and `dhcpd dns <ip>` but there is no direct `default-router` command; instead, the default gateway is automatically set to the interface IP of the ASA.
For IOS-XR (e.g., ASR 9000), the DHCP server feature is not supported; instead, IOS-XR uses a separate DHCP server implementation or relies on external servers. Therefore, the `default-router` command does not exist in IOS-XR. In older IOS versions (12.x), the command is the same, but the DHCP pool configuration mode may be entered differently (e.g., `ip dhcp pool` is available from 12.0 onward).
In IOS 15.x and 16.x, the command remains unchanged. One behavior difference: in some IOS versions, if you specify multiple default routers, the order in the DHCP offer may vary; but generally, the first listed is primary. Always verify with `show ip dhcp pool` to see the exact order.
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