Courseiva
RoutingGlobal Config

ip route 0.0.0.0 0.0.0.0 [next-hop]

Configures a default route (gateway of last resort) on a Cisco router, directing all traffic with no specific route in the routing table to the specified next-hop IP address.

Definition: ip route 0.0.0.0 0.0.0.0 [next-hop] is a Cisco IOS global config command. Configures a default route (gateway of last resort) on a Cisco router, directing all traffic with no specific route in the routing table to the specified next-hop IP address.

Overview

The `ip route 0.0.0.0 0.0.0.0 [next-hop]` command is used to configure a default route, also known as the gateway of last resort, on a Cisco router. This route matches any destination IP address that does not have a more specific match in the routing table. It is essential for providing connectivity to external networks, such as the internet, when a router does not have a default gateway learned via a dynamic routing protocol.

The command is entered in global configuration mode and requires a next-hop IP address (or exit interface) to forward traffic. The default route is a static route with a prefix length of /0, meaning it matches all destinations. It is used when the router needs to send traffic to networks not directly connected or learned via routing protocols.

Alternatives include using dynamic routing protocols like OSPF or EIGRP to propagate a default route, or configuring a static default route via an interface (e.g., `ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/0`). The command is critical in hub-and-spoke topologies, branch offices, and internet edge routers. In troubleshooting, verifying the default route is often the first step in diagnosing connectivity issues to external networks.

The command immediately updates the running configuration and can be saved to startup configuration with `copy running-config startup-config`. Privilege level 15 (privileged EXEC) is required to enter global configuration mode. The router will install the default route in the routing table with an administrative distance of 1 (static route) by default.

If multiple default routes exist, the one with the lowest administrative distance is preferred. The command does not produce buffered output; it simply adds the route to the configuration. Understanding the default route is fundamental for CCNA and CCNP candidates as it appears in many network designs and troubleshooting scenarios.

Syntax·Global Config
ip route 0.0.0.0 0.0.0.0 [next-hop]

When to Use This Command

  • Connecting a branch office router to the internet via a single ISP router at 203.0.113.1
  • Providing a backup default route with a higher administrative distance for WAN link redundancy
  • Sending all unknown traffic to a firewall for security inspection in a corporate network
  • Configuring a default route on a stub router that only has a single upstream connection

Parameters

ParameterSyntaxDescription
next-hopA.B.C.DThe IP address of the next-hop router to which packets destined for any network will be forwarded. This must be a valid IP address reachable from the router. Common mistakes include using an incorrect IP address or an address that is not directly connected, which can cause traffic to be black-holed.

Command Examples

Basic default route to ISP

ip route 0.0.0.0 0.0.0.0 203.0.113.1

No output is produced on successful configuration. Use 'show ip route' to verify.

Default route with floating static backup

ip route 0.0.0.0 0.0.0.0 10.0.0.2 200

The administrative distance 200 makes this a floating static route, only used if the primary default route (distance 1) fails.

Understanding the Output

The 'ip route 0.0.0.0 0.0.0.0' command does not produce any output on the CLI. To verify the configuration, use 'show ip route' or 'show ip route 0.0.0.0'. In the routing table, a default route appears as 'S* 0.0.0.0/0 [1/0] via 203.0.113.1'.

The 'S' indicates a static route, '*' means it is the candidate default route (gateway of last resort), '[1/0]' shows administrative distance and metric, and 'via' shows the next-hop IP. A missing default route means the router will drop packets destined for unknown networks.

Configuration Scenarios

Configure a default route to an ISP router

A branch office router needs internet access via an ISP router. The ISP router is directly connected on interface GigabitEthernet0/0 with IP 203.0.113.2/30.

Topology

Branch-Router(Gi0/0)---203.0.113.0/30---(Gi0/0)ISP-Router

Steps

  1. 1.Step 1: Enter privileged EXEC mode: Router> enable
  2. 2.Step 2: Enter global configuration mode: Router# configure terminal
  3. 3.Step 3: Configure the default route: Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.2
  4. 4.Step 4: Exit configuration mode: Router(config)# end
  5. 5.Step 5: Verify the route: Router# show ip route
Configuration
! Full IOS config block
Router> enable
Router# configure terminal
Router(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.2
Router(config)# end

Verify: Use `show ip route` and look for a line starting with 'S*' (static default route). Expected output: 'S* 0.0.0.0/0 [1/0] via 203.0.113.2'

Watch out: Ensure the next-hop IP is directly connected; otherwise, the route will not be installed in the routing table.

Configure a default route using an exit interface

A router has a point-to-point serial link to a service provider. Using the exit interface instead of next-hop IP can simplify configuration and avoid ARP issues.

Topology

Router(Serial0/0/0)---10.0.0.0/30---(Serial0/0/0)Provider-Router

Steps

  1. 1.Step 1: Enter privileged EXEC mode: Router> enable
  2. 2.Step 2: Enter global configuration mode: Router# configure terminal
  3. 3.Step 3: Configure the default route with exit interface: Router(config)# ip route 0.0.0.0 0.0.0.0 Serial0/0/0
  4. 4.Step 4: Exit configuration mode: Router(config)# end
  5. 5.Step 5: Verify the route: Router# show ip route
Configuration
! Full IOS config block
Router> enable
Router# configure terminal
Router(config)# ip route 0.0.0.0 0.0.0.0 Serial0/0/0
Router(config)# end

Verify: Use `show ip route` and look for a line starting with 'S*' with the interface listed. Expected output: 'S* 0.0.0.0/0 is directly connected, Serial0/0/0'

Watch out: Using an exit interface on a multi-access network (e.g., Ethernet) can cause the router to ARP for every destination, leading to high CPU usage. Prefer next-hop IP on Ethernet links.

Troubleshooting with This Command

When troubleshooting connectivity issues, the first step is often to verify the presence of a default route. Use `show ip route` and look for a line starting with 'S*' (static default route) or 'O*' (OSPF default), etc. If no default route exists, the router will drop packets destined for unknown networks, resulting in 'Destination Unreachable' ICMP messages. A healthy output shows a default route with a valid next-hop or interface.

Problem indicators include: no default route at all, a default route pointing to an unreachable next-hop, or a default route with a high administrative distance that is not preferred. Focus on the 'via' field (next-hop IP) or interface, and the administrative distance. Common symptoms this command helps diagnose include: inability to reach the internet, intermittent connectivity to external sites, or asymmetric routing.

The diagnostic flow: 1) Check `show ip route` for default route. 2) If missing, check if a static route is configured with `show running-config | include ip route 0.0.0.0`. 3) If configured but not in table, verify next-hop reachability with `ping` or `show ip arp`. 4) If next-hop is reachable, check for routing table conflicts (e.g., a more specific route that might be preferred). 5) Use `show ip route 0.0.0.0` to see detailed information. 6) Correlate with `show ip interface brief` to ensure the exit interface is up/up. 7) Use `debug ip routing` (with caution) to see route installation events. The default route can also be learned via dynamic protocols; check `show ip protocols` to see if a default route is being redistributed. In complex scenarios, use `traceroute` to see the path taken and identify where traffic stops.

The `show ip cef` command can show the forwarding entry for the default route. Remember that the default route is only used if no other more specific route matches; verify that there are no overlapping routes that might cause unexpected behavior.

CCNA Exam Tips

1.

The default route uses prefix 0.0.0.0/0, which matches all destinations.

2.

Administrative distance for static routes defaults to 1; a floating static route uses a higher AD (e.g., 200) to act as a backup.

3.

The '*' in 'show ip route' output indicates the gateway of last resort; if missing, the router has no default route.

4.

CCNA often tests the difference between a default route and a default network (ip default-network).

Common Mistakes

Using a subnet mask like 255.255.255.0 instead of 0.0.0.0 for the default route.

Forgetting to specify the next-hop IP, causing the command to be rejected.

Configuring a default route with an incorrect next-hop IP that is not reachable, leading to traffic blackholing.

ip route 0.0.0.0 0.0.0.0 [next-hop] vs show ip route

These two commands are commonly confused because both are essential for managing default routing, but one configures a default gateway while the other displays the routing table. Understanding their distinct purposes prevents misconfiguration during network troubleshooting.

Aspectip route 0.0.0.0 0.0.0.0 [next-hop]show ip route
ScopeConfigures static default routeDisplays entire IP routing table
ModeGlobal configuration modePrivileged EXEC mode
PersistencePersistent across rebootsTransient output, no configuration change
EffectAdds a route to the routing tableNo effect on router state
Typical UseSet gateway of last resortVerify active routes and next-hops

Use ip route 0.0.0.0 0.0.0.0 [next-hop] when you need to configure a default route for traffic without a specific match in the routing table.

Use show ip route when you need to verify the current routing table, including the presence and source of default routes.

Platform Notes

In IOS-XE, the command syntax is identical to classic IOS. The output of `show ip route` may include additional fields like 'U' (per-user static route) but the default route display remains the same. In NX-OS (e.g., Nexus switches), the equivalent command is `ip route 0.0.0.0/0 <next-hop>` (using CIDR notation).

NX-OS also supports `ip route 0.0.0.0/0 <interface>` but the syntax is slightly different. For ASA firewalls, the equivalent is `route outside 0.0.0.0 0.0.0.0 <next-hop>` (note the different command structure). In IOS-XR, the command is `router static` then `address-family ipv4 unicast` then `0.0.0.0/0 <next-hop>`; the configuration is hierarchical.

Between IOS versions (12.x, 15.x, 16.x), the command behavior is consistent, but newer versions may support additional options like `vrf` or `track`. For example, in IOS 15.x and later, you can use `ip route 0.0.0.0 0.0.0.0 <next-hop> track <track-number>` to track the reachability of the next-hop. The command is available in all IOS versions that support static routing.

On some platforms, using an exit interface on a broadcast network may cause the router to perform ARP for every destination, which is not recommended; use next-hop IP instead. In NX-OS, the default route can also be configured with a prefix-length of 0 (e.g., `ip route 0.0.0.0/0 10.0.0.1`). Always verify the specific platform documentation for exact syntax.

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