ipv6 route [prefix/len] [next-hop]
Configures a static IPv6 route in the global routing table, specifying the destination prefix and next-hop address or exit interface.
Definition: ipv6 route [prefix/len] [next-hop] is a Cisco IOS global config command. Configures a static IPv6 route in the global routing table, specifying the destination prefix and next-hop address or exit interface.
Overview
The 'ipv6 route' command is used to configure static IPv6 routes in the global routing table on Cisco IOS devices. Static routes are manually defined paths to destination networks, providing a simple and predictable way to direct traffic without the overhead of dynamic routing protocols. This command is essential when you need to establish connectivity to networks that are not directly connected, especially in small networks, stub networks, or when you want to control traffic flow precisely.
It is also commonly used to create default routes (::/0) to send all traffic to a specific next-hop, such as an upstream ISP router. Static routes are often preferred over dynamic protocols when network topology is stable and simple, or when you need to reduce routing protocol overhead. They also serve as a fallback or backup in case dynamic routing fails.
In a broader configuration workflow, static routes are typically configured after interface IP addresses are set and before dynamic routing protocols are enabled, if any. They are stored in the running configuration and can be saved to startup configuration. The command requires global configuration mode, which is privileged (enable) mode.
There is no buffered output; the command takes effect immediately. One important behavior: if the next-hop address is not reachable (e.g., no route to that address), the static route will not be installed in the routing table. Also, if the exit interface is specified instead of a next-hop, the route is considered directly connected and will be installed even if the next-hop is not reachable, but it may cause issues if the interface goes down.
The command can also be used with a global unicast address or a link-local address as next-hop; when using link-local, the exit interface must be specified. Understanding static routes is fundamental for CCNA and CCNP candidates as it forms the basis for routing concepts and troubleshooting.
ipv6 route [prefix/len] [next-hop]When to Use This Command
- Pointing a default route (::/0) to an ISP next-hop address for internet connectivity.
- Creating a static route to a remote branch network via a specific next-hop router.
- Using an exit interface (e.g., GigabitEthernet0/0) for directly connected static routes.
- Configuring a floating static route with a higher administrative distance as a backup.
Parameters
| Parameter | Syntax | Description |
|---|---|---|
| prefix/len | X:X:X:X::X/<0-128> | The destination IPv6 network prefix and prefix length. For example, 2001:db8:1::/48 or ::/0 for default route. Common mistake: forgetting the slash and prefix length, or using an invalid prefix length. |
| next-hop | X:X:X:X::X | The IPv6 address of the next-hop router or the exit interface (e.g., GigabitEthernet0/0). If a link-local address is used, the exit interface must be specified. Common mistake: using a next-hop that is not reachable, causing the route not to be installed. |
Command Examples
Static route to a remote network via next-hop
ipv6 route 2001:db8:acad:2::/64 2001:db8:acad:1::2No output is generated on successful configuration. Use 'show ipv6 route static' to verify.
Default static route via exit interface
ipv6 route ::/0 GigabitEthernet0/0No output on success. The route is installed with next-hop as directly connected interface.
Understanding the Output
The 'ipv6 route' command produces no output upon successful entry. To verify, use 'show ipv6 route static' or 'show ipv6 route'. In the routing table, static routes appear with code 'S'.
The output shows the prefix, next-hop, administrative distance (default 1), and metric (default 0). A valid route will have a next-hop reachable via a connected interface; if the next-hop is unreachable, the route will not be installed. Watch for 'S' entries with 'via' pointing to a valid next-hop or interface.
Configuration Scenarios
Configure a static default route to an ISP router
A branch office router needs to send all internet-bound traffic to an upstream ISP router. The ISP router is directly connected via GigabitEthernet0/0 with link-local address fe80::1.
Topology
Branch_Router(Gi0/0)---2001:db8:1::/64---(Gi0/0)ISP_RouterSteps
- 1.Step 1: Enter global configuration mode: Branch_Router# configure terminal
- 2.Step 2: Configure the static default route: Branch_Router(config)# ipv6 route ::/0 GigabitEthernet0/0 fe80::1
- 3.Step 3: Exit configuration mode: Branch_Router(config)# end
- 4.Step 4: Verify the route: Branch_Router# show ipv6 route static
! Configure static default route via exit interface and link-local next-hop Branch_Router(config)# ipv6 route ::/0 GigabitEthernet0/0 fe80::1
Verify: Use 'show ipv6 route static' to see the static route. Expected output includes 'S ::/0 [1/0] via fe80::1, GigabitEthernet0/0'.
Watch out: When using a link-local next-hop, you must specify the exit interface; otherwise, the command will be rejected.
Configure a static route to a remote network via a next-hop address
A router needs to reach a remote network 2001:db8:2::/48 via a next-hop router at 2001:db8:1::2. The next-hop is reachable via the directly connected network 2001:db8:1::/64.
Topology
R1(Gi0/0)---2001:db8:1::/64---(Gi0/0)R2---2001:db8:2::/48Steps
- 1.Step 1: Enter global configuration mode: R1# configure terminal
- 2.Step 2: Configure the static route: R1(config)# ipv6 route 2001:db8:2::/48 2001:db8:1::2
- 3.Step 3: Exit and verify: R1(config)# end; R1# show ipv6 route 2001:db8:2::/48
! Static route to remote network via next-hop R1(config)# ipv6 route 2001:db8:2::/48 2001:db8:1::2
Verify: Use 'show ipv6 route 2001:db8:2::/48' to confirm the route is installed. Expected output: 'S 2001:db8:2::/48 [1/0] via 2001:db8:1::2'.
Watch out: If the next-hop address is not reachable (e.g., no route to 2001:db8:1::2), the static route will not appear in the routing table. Ensure the directly connected network is up and the next-hop is reachable.
Troubleshooting with This Command
When troubleshooting static IPv6 routes, the primary command is 'show ipv6 route static' to list all static routes. Healthy output shows the route with a code 'S' and a valid next-hop. If a static route is missing, check if the next-hop is reachable using 'ping' or 'traceroute' to the next-hop address.
Also verify that the exit interface is up/up with 'show ipv6 interface brief'. A common symptom is that a static route is configured but not present in the routing table; this often means the next-hop is unreachable. Use 'show ipv6 route' to see if there is a route to the next-hop.
For default routes, ensure the next-hop is reachable. Another issue is using a link-local next-hop without specifying the exit interface; the command will be accepted but the route may not be installed if the interface is down. Use 'debug ipv6 routing' to see route installation events, but be cautious in production.
If a static route is not working as expected, check the administrative distance (default 1) and ensure there is no conflicting route from a dynamic protocol with a lower distance. Use 'show ipv6 route [prefix]' to see the specific route details. Also, verify that the destination network is not already directly connected.
In complex scenarios, use 'traceroute' to the destination to see the path taken. Correlate with 'show ipv6 interface' to confirm IPv6 is enabled on the interface. If the route is present but traffic fails, check for ACLs or firewall rules blocking traffic.
For recursive static routes (next-hop not directly connected), ensure the recursive route exists. The command 'show ipv6 cef' can show the forwarding information. A step-by-step diagnostic flow: 1) Verify the static route is configured with 'show running-config | include ipv6 route'. 2) Check if it appears in the routing table with 'show ipv6 route static'. 3) If missing, ping the next-hop. 4) If ping fails, check interface status and IPv6 connectivity. 5) If ping succeeds, check for routing loops or incorrect prefix length. 6) Use 'debug ipv6 packet' carefully to see if packets are being forwarded.
Remember that static routes have an administrative distance of 1, so they override dynamic routes unless a higher distance is configured.
CCNA Exam Tips
Remember that the default administrative distance for static routes is 1, but you can change it with the 'distance' parameter.
For directly connected static routes, use an exit interface instead of a next-hop address to avoid recursive lookups.
CCNA exam may ask to configure a floating static route by setting a higher AD (e.g., 5) to back up a dynamic route.
Know that 'ipv6 route ::/0' creates a default route; the prefix length must be /0.
Common Mistakes
Forgetting to specify the next-hop or interface, causing the command to be rejected.
Using an incorrect prefix length (e.g., /64 instead of /0 for default route).
Configuring a static route with a next-hop that is not reachable, resulting in the route not being installed.
ipv6 route [prefix/len] [next-hop] vs ipv6 unicast-routing
These commands are commonly confused because both are required for IPv6 static routing: 'ipv6 unicast-routing' enables IPv6 packet forwarding, while 'ipv6 route' defines a static path. Without the former, static routes are ignored; without the latter, no static route exists.
| Aspect | ipv6 route [prefix/len] [next-hop] | ipv6 unicast-routing |
|---|---|---|
| Scope | Global routing table entry | Global routing process state |
| Functionality | Adds a static route to the RIB | Enables IPv6 packet forwarding and routing protocols |
| Effect on Routing Table | Inserts route for specified prefix | No direct route insertion; allows routes to be used |
| Dependencies | Needs ipv6 unicast-routing to be active for route to be installed | Must be configured before any IPv6 routes or protocols are used |
| Typical Use Case | Defining a default route or static path to a remote network | First step in configuring any IPv6 routing |
Use ipv6 route [prefix/len] [next-hop] when you need a static path to a specific IPv6 destination that is not learned dynamically.
Use ipv6 unicast-routing when you first enable IPv6 on a router that will forward packets or participate in IPv6 routing protocols.
Platform Notes
In IOS-XE, the 'ipv6 route' command syntax is identical to classic IOS. However, in NX-OS (Cisco Nexus switches), the equivalent command is 'ipv6 route [prefix/len] [next-hop]' but the configuration mode is 'configure terminal' and the command is applied in the global configuration context. NX-OS also supports 'ipv6 route [prefix/len] [next-hop] [name]' for route tags.
On ASA firewalls, IPv6 static routes are configured using 'ipv6 route [interface] [prefix/len] [next-hop]' in global configuration mode, but the syntax differs slightly: you must specify the interface before the prefix. For example: 'ipv6 route inside 2001:db8:1::/48 2001:db8:2::1'. In IOS-XR, the command is 'router static' then 'address-family ipv6 unicast' and then 'prefix/len next-hop'.
For example: 'router static address-family ipv6 unicast 2001:db8:1::/48 2001:db8:2::1'. The output of 'show ipv6 route' in IOS-XE is similar to classic IOS, but in NX-OS, the output format is different, using 'show ipv6 route' and showing 'S' for static. In IOS versions 12.x and 15.x, the command is the same, but 16.x (IOS-XE) may have minor differences in output formatting.
Always verify the specific platform documentation. For CCNA/CCNP, the classic IOS syntax is the focus, but awareness of platform differences is important.
Related Commands
ipv6 unicast-routing
Enables IPv6 unicast routing on a Cisco router, allowing it to forward IPv6 packets and participate in IPv6 routing protocols.
show ipv6 route
Displays the IPv6 routing table on a Cisco router, showing all known IPv6 routes and their next-hop information for troubleshooting and verification of IPv6 routing.
show running-config
Displays the current active configuration in DRAM, showing all non-default settings.
Practice for the CCNA 200-301
Test your knowledge with practice questions covering all CCNA 200-301 exam domains.
Practice CCNA 200-301 Questions