Courseiva
RoutingGlobal Config

ip route [net] [mask] [hop] [ad]

Configures a static route with an administrative distance to create a floating static route that serves as a backup when the primary dynamic route fails.

Definition: ip route [net] [mask] [hop] [ad] is a Cisco IOS global config command. Configures a static route with an administrative distance to create a floating static route that serves as a backup when the primary dynamic route fails.

Overview

The `ip route [net] [mask] [hop] [ad]` command in global configuration mode is used to configure a static route with an administrative distance (AD) value, creating a floating static route. This route is installed in the routing table only if no other route to the same destination network exists with a lower AD. The default AD for static routes is 1, but by specifying a higher AD (e.g., 5, 10, or higher), the static route becomes a backup for dynamic routing protocols like OSPF (AD 110) or EIGRP (AD 90/170).

This is critical for network redundancy: if the primary dynamic route fails (e.g., a link goes down or a neighbor disappears), the floating static route takes over, ensuring continued connectivity. Network engineers use this command when they need a simple, predictable backup path without the complexity of running a dynamic routing protocol everywhere, or when they want to override a dynamic route with a static one for policy reasons. It fits into the broader configuration workflow after dynamic routing is set up; you add floating statics as a safety net.

Important IOS behavior: the route appears in the running config and is saved to startup config; it is not buffered. Privilege level 15 (enable) is required. The command immediately affects the routing table if the AD is lower than any existing route; if not, it remains inactive until the primary route disappears.

This command is a staple for CCNA and CCNP candidates because it demonstrates understanding of administrative distance and route selection.

Syntax·Global Config
ip route [net] [mask] [hop] [ad]

When to Use This Command

  • Backup WAN link: Configure a floating static route via a secondary ISP with higher AD so it only appears in the routing table when the primary OSPF/EIGRP route goes down.
  • Dual-homed branch office: Use floating static routes to provide failover between two connections to different providers.
  • Load balancing with preference: Set a floating static route with AD 200 to act as a last-resort backup for a dynamic routing protocol.
  • Testing redundancy: Temporarily add a floating static route to verify failover behavior without removing the primary route.

Parameters

ParameterSyntaxDescription
netA.B.C.DThe destination network IP address (e.g., 192.168.1.0). Must be a valid classful or classless network address. Common mistake: using a host address instead of a network address, which can cause unexpected routing behavior.
maskA.B.C.DThe subnet mask for the destination network (e.g., 255.255.255.0). Must match the network portion. Common mistake: using an incorrect mask that does not align with the network address, leading to route not being installed.
hopA.B.C.DThe next-hop IP address (e.g., 10.0.0.1) or exit interface (e.g., GigabitEthernet0/0). Must be reachable from the router. Common mistake: using an unreachable next-hop or a next-hop that is not directly connected, which causes the route to be inactive.
ad<1-255>The administrative distance value for the static route. Values from 1 to 255; higher values make the route less preferred. Common mistake: using a value lower than the dynamic protocol's AD, which makes the static route primary instead of backup.

Command Examples

Floating static route as backup for OSPF

ip route 10.0.0.0 255.255.255.0 192.168.2.1 200

This command adds a static route to network 10.0.0.0/24 via next-hop 192.168.2.1 with an administrative distance of 200. Since OSPF has a default AD of 110, this route will only be used if the OSPF route disappears.

Floating default route for backup internet

ip route 0.0.0.0 0.0.0.0 10.0.0.1 200

Creates a floating default route via 10.0.0.1 with AD 200. This will only be used if the primary default route (e.g., from DHCP or a lower AD static route) is removed.

Understanding the Output

The 'ip route' command itself does not produce output; it configures the route in the running configuration. To verify, use 'show ip route' or 'show running-config | include ip route'. In 'show ip route', floating static routes appear only when the primary route is absent.

Look for the route with the higher AD (e.g., 200) in the routing table. If the primary route is present, the floating route will not be listed. A successful failover shows the floating route with its AD, and the next-hop should be reachable.

Watch for routes that unexpectedly appear or disappear, indicating network instability.

Configuration Scenarios

Floating Static Route as Backup for OSPF

A branch router (R1) connects to HQ via two links: a primary OSPF-learned route over a high-speed link, and a backup serial link. The goal is to use the serial link only if the primary fails.

Topology

R1(Gi0/0)---10.0.12.0/30---(Gi0/0)R2 (OSPF) R1(Se0/0/0)---192.168.1.0/30---(Se0/0/0)R2 (backup)

Steps

  1. 1.Step 1: Enter global configuration mode: configure terminal
  2. 2.Step 2: Configure OSPF on R1: router ospf 1, network 10.0.12.0 0.0.0.3 area 0
  3. 3.Step 3: Add a floating static route for the HQ LAN (192.168.2.0/24) via the backup serial link with AD 150: ip route 192.168.2.0 255.255.255.0 192.168.1.2 150
  4. 4.Step 4: Exit and verify: end, show ip route
Configuration
!
interface GigabitEthernet0/0
 ip address 10.0.12.1 255.255.255.252
!
interface Serial0/0/0
 ip address 192.168.1.1 255.255.255.252
!
router ospf 1
 network 10.0.12.0 0.0.0.3 area 0
!
ip route 192.168.2.0 255.255.255.0 192.168.1.2 150
!

Verify: show ip route 192.168.2.0 Expected output when OSPF is up: 'O 192.168.2.0/24 [110/2] via 10.0.12.2, 00:00:10, GigabitEthernet0/0' When OSPF fails: 'S 192.168.2.0/24 [150/0] via 192.168.1.2'

Watch out: Ensure the backup link is up and the next-hop is reachable; otherwise, the floating route will not be installed even if the primary fails.

Floating Static Route for EIGRP Backup with Exit Interface

A router (R1) has an EIGRP-learned route to 10.10.0.0/16 via a primary link. A backup link uses a directly connected interface. The floating static route uses the exit interface instead of next-hop IP.

Topology

R1(Gi0/0)---172.16.1.0/30---(Gi0/0)R2 (EIGRP) R1(Gi0/1)---172.16.2.0/30---(Gi0/1)R2 (backup)

Steps

  1. 1.Step 1: Enter global configuration mode: configure terminal
  2. 2.Step 2: Configure EIGRP on R1: router eigrp 100, network 172.16.1.0 0.0.0.3
  3. 3.Step 3: Add floating static route using exit interface GigabitEthernet0/1 with AD 200: ip route 10.10.0.0 255.255.0.0 GigabitEthernet0/1 200
  4. 4.Step 4: Verify: end, show ip route 10.10.0.0
Configuration
!
interface GigabitEthernet0/0
 ip address 172.16.1.1 255.255.255.252
!
interface GigabitEthernet0/1
 ip address 172.16.2.1 255.255.255.252
!
router eigrp 100
 network 172.16.1.0 0.0.0.3
!
ip route 10.10.0.0 255.255.0.0 GigabitEthernet0/1 200
!

Verify: show ip route 10.10.0.0 Expected output when EIGRP is up: 'D 10.10.0.0/16 [90/3072] via 172.16.1.2, 00:00:15, GigabitEthernet0/0' When EIGRP fails: 'S 10.10.0.0/16 [200/0] via 172.16.2.2, GigabitEthernet0/1'

Watch out: Using an exit interface requires the router to have a direct connection; if the interface goes down, the route is removed. Also, the AD must be higher than EIGRP's internal AD (90) or external AD (170).

Troubleshooting with This Command

When troubleshooting floating static routes, the primary tool is `show ip route [network]` to see which route is active. Healthy output shows the expected primary dynamic route with its AD and next-hop. If the floating static route is active when it shouldn't be, check if the dynamic route is missing due to a neighbor down, misconfiguration, or network issue.

Focus on the AD values: the floating static route should have a higher AD than the dynamic protocol. Common symptoms: the backup route never takes over when the primary fails — this often means the next-hop is unreachable or the interface is down. Use `show ip route` to see if the route is in the table; if not, use `show ip route static` to list all static routes.

Also check `show ip interface brief` to verify interface status. A step-by-step diagnostic flow: 1) Identify the destination network. 2) Run `show ip route <network>` — if no route, check static route configuration. 3) If static route is present but not active, verify next-hop reachability with `ping` and `show ip arp`. 4) Check administrative distance: ensure the static route's AD is higher than the dynamic protocol's AD. 5) If the floating route is active but shouldn't be, check if the dynamic protocol is down; use `show ip ospf neighbor` or `show ip eigrp neighbors`. 6) Correlate with `debug ip routing` to see route installation events. For example, if OSPF fails, you'll see the floating route installed.

If the floating route doesn't appear, check for a route with lower AD from another source. Also, ensure the mask matches exactly; a misconfigured mask can cause the route to not match the destination.

CCNA Exam Tips

1.

CCNA exam tip: Floating static routes use a higher AD than the primary dynamic protocol; default ADs: OSPF 110, EIGRP 90/170, static 1, floating static > 1.

2.

CCNA exam tip: The AD must be higher than the primary route's AD but lower than 255 (unreachable). Common values: 200 for backup.

3.

CCNA exam tip: Exam may ask which route is preferred when multiple routes exist; the lowest AD wins.

4.

CCNA exam tip: Floating static routes are not redistributed into dynamic protocols by default; you must configure redistribution if needed.

Common Mistakes

Mistake 1: Setting AD too low (e.g., 100) causing the static route to override OSPF (AD 110) unintentionally.

Mistake 2: Forgetting to specify the next-hop IP or exit interface, leading to an incomplete route.

Mistake 3: Using the same AD as the primary route, causing equal-cost load balancing instead of failover.

ip route [net] [mask] [hop] [ad] vs show ip route

Both commands are used in static route management but serve opposite purposes: one configures, the other verifies. They are often considered together because 'ip route' creates a static route with an administrative distance (creating a floating static), while 'show ip route' displays the routing table including any static routes and their ADs, making them complementary for troubleshooting backup routes.

Aspectip route [net] [mask] [hop] [ad]show ip route
ScopeConfigures a single static route per command invocationDisplays all routes in the IP routing table
Configuration modeGlobal configuration modePrivileged EXEC mode
PersistenceSaved to startup-config when 'copy running-config startup-config' is issuedNot saved; output is live and transient
PrecedenceRoute uses administrative distance 'ad' for route selection when multiple routes to the same destination existShows the active administrative distance of each route as used in the routing table
Typical useCreating a floating static route as a backup with higher AD than dynamic protocolVerifying that the floating static route is installed or checking routing table contents

Use ip route [net] [mask] [hop] [ad] when you need to inject a static route into the routing table with a custom administrative distance, typically to create a floating static backup for a dynamically learned route.

Use show ip route when you need to inspect the current routing table to verify route presence, administrative distances, next-hop IPs, and outgoing interfaces for troubleshooting or monitoring.

Platform Notes

In IOS-XE (e.g., Catalyst 9000 switches), the syntax is identical: `ip route [net] [mask] [hop] [ad]`. However, IOS-XE may support additional parameters like `name` or `tag` for route-maps. The output of `show ip route` is similar but may include VRF information.

In NX-OS (e.g., Nexus switches), the equivalent command is `ip route [net] [mask] [next-hop] [ad]` but note that NX-OS uses a different routing table structure; the command is entered in global configuration mode but the AD parameter is placed after the next-hop, e.g., `ip route 10.10.0.0/16 172.16.2.2 200`. NX-OS also supports `ip route [vrf]` for VRFs. On ASA firewalls, static routes are configured with `route [if_name] [net] [mask] [gateway] [metric]` where metric is similar to AD; the command is `route outside 10.10.0.0 255.255.0.0 172.16.2.2 200`.

ASA does not use the term 'administrative distance' but 'metric' for route preference. In IOS-XR, the command is `router static` then `address-family ipv4 unicast` and then `[net]/[length] [next-hop] [distance]`; e.g., `router static address-family ipv4 unicast 10.10.0.0/16 172.16.2.2 200`. IOS-XR requires explicit address-family configuration.

Between IOS versions, the command has remained stable from 12.x to 16.x, but newer versions may support IPv6 with `ipv6 route`. Always check the specific platform documentation for any syntax nuances.

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