RoutingGlobal Config

router static address-family ipv4 unicast [prefix/len] [nh]

Configures a static route in the IPv4 unicast routing table.

Overview

The 'router static address-family ipv4 unicast' command in Cisco IOS-XR is used to configure static routes for IPv4 unicast traffic. Static routes are manually entered by a network administrator and are used to define explicit paths for traffic to reach specific destinations. Unlike dynamic routing protocols, static routes do not adapt to network changes unless manually updated. This command is essential for small networks, stub networks, or when you need to override dynamic routing decisions. In IOS-XR, static routes are configured under the 'router static' configuration mode, followed by the 'address-family ipv4 unicast' sub-mode. The prefix is specified in CIDR notation (e.g., 10.10.10.0/24), and the next-hop can be an IP address, an interface, or a combination. IOS-XR supports features like floating static routes (using administrative distance), permanent routes, and tracking objects for high availability. Static routes are commonly used for default routes, connecting to non-dynamic networks, or providing backup paths. In troubleshooting workflows, static routes are verified using 'show route static' or 'show running-config router static'. Misconfigurations can lead to routing loops or black holes, so careful planning is required.

Syntax·Global Config
router static address-family ipv4 unicast [prefix/len] [nh]

When to Use This Command

  • Pointing a default route to a next-hop IP address for internet connectivity.
  • Creating a static route to a specific subnet via a next-hop IP.
  • Using a static route as a backup when dynamic routing fails.
  • Configuring a static route to a null interface for traffic blackholing.

Parameters

ParameterSyntaxDescription
prefix/lenA.B.C.D/lengthThe destination network in CIDR notation. For example, 10.10.10.0/24 specifies the network 10.10.10.0 with a 24-bit subnet mask.
nhA.B.C.D | interface-type interface-instance [A.B.C.D]The next-hop IP address or outgoing interface. If an interface is specified, the next-hop IP is optional. For point-to-point interfaces, the interface alone is sufficient.

Command Examples

Configure a default static route

router static address-family ipv4 unicast 0.0.0.0/0 192.168.1.1

No output on success; the route is added to the configuration.

Configure a static route to a specific subnet

router static address-family ipv4 unicast 10.10.10.0/24 192.168.1.2

No output on success; the route is added to the configuration.

Understanding the Output

The command does not produce output upon successful configuration. To verify, use 'show running-config router static' or 'show route static'. The 'show route static' output displays the prefix, next-hop, and administrative distance. A healthy route shows 'S' (static) in the routing table. Problematic routes may show as inactive if the next-hop is unreachable.

Configuration Scenarios

Default Route to Internet

A branch office with a single internet connection via a router at 192.168.1.1.

Topology

Branch Router --- ISP Router (192.168.1.1)

Steps

  1. 1.Enter global configuration mode.
  2. 2.Enter 'router static' configuration mode.
  3. 3.Enter 'address-family ipv4 unicast'.
  4. 4.Configure the default route: '0.0.0.0/0 192.168.1.1'.
  5. 5.Exit and verify.
Configuration
!
router static
 address-family ipv4 unicast
  0.0.0.0/0 192.168.1.1
!

Verify: Use 'show route 0.0.0.0/0' to see the static route in the routing table.

Watch out: Ensure the next-hop IP is reachable via a directly connected interface; otherwise, the route will be inactive.

Troubleshooting with This Command

When troubleshooting static routes in IOS-XR, first verify the configuration with 'show running-config router static'. If the route is not appearing in the routing table, check if the next-hop is reachable using 'ping' or 'show arp'. Use 'show route static' to see all configured static routes and their status. A route marked as 'inactive' indicates the next-hop is not reachable. Also, check for routing loops by ensuring the static route does not point back to the router itself. If using floating static routes, verify the administrative distance is higher than the dynamic route. In IOS-XR, static routes can be associated with a tracking object to monitor reachability; use 'show track' to verify object status. Common issues include incorrect prefix length, missing next-hop, or interface down. Use 'debug ip routing' cautiously to see route installation events.

CCNA Exam Tips

1.

Remember that IOS-XR requires 'router static' and 'address-family ipv4 unicast' before the prefix.

2.

Static routes have a default administrative distance of 1; you can change it with the 'distance' keyword.

3.

In IOS-XR, static routes are not automatically redistributed; you must configure redistribution if needed.

Common Mistakes

Forgetting to enter 'router static' and 'address-family ipv4 unicast' configuration modes.

Using the wrong syntax (e.g., 'ip route' instead of 'router static').

Not specifying a next-hop that is directly connected, causing the route to be inactive.

Platform Notes

In Cisco IOS-XR, static route configuration differs from classic IOS. IOS uses 'ip route prefix mask next-hop' under global config, while IOS-XR requires entering 'router static' and 'address-family ipv4 unicast' submodes. IOS-XR also supports additional features like 'permanent' and 'tag' options. The 'show route' command in IOS-XR displays routes with 'S' for static, similar to IOS. For equivalent commands on other platforms, Juniper uses 'set routing-options static route prefix next-hop next-hop'. In IOS-XR, static routes can be configured with a 'vrf' parameter for VRF-aware routing. Version differences: In earlier IOS-XR versions, the 'router static' command was not available; static routes were configured under 'router' with 'static' keyword. Always check the specific version documentation.

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions