Network Bytes · Episode 104 · CCNA 3.3
"IPv6 static and default routes"
An IPv6 static route works just like an IPv4 one, a sign you put up on a router that says "to reach this network, send packets to that next router." On a Cisco router you first turn on IPv6 routing with ipv6 unicast-routing, then add routes with ipv6 route, the prefix and its length, then the next hop. The default route is ::/0, which has zero network bits and so matches every IPv6 address.
Static routes, same idea as IPv4
A router forwards a packet by looking up its destination address in the routing table. Networks the router is plugged into get there by themselves. For any network further away, the router has to learn a path, either from a routing protocol or from you.
A static route is the path you type in by hand. It works exactly like an IPv4 static route: you name a destination network and the next hop, the address of the neighbouring router that can get packets closer. Think of it as a signpost you pin up on the router.
Step 1: turn on IPv6 routing
Cisco routers forward IPv4 out of the box, but not IPv6. Until you enable it, a router will happily have IPv6 addresses on its interfaces and answer pings, yet it won't route IPv6 packets between networks. One global command switches it on:
`` R1(config)# ipv6 unicast-routing ``
Step 2: add the static route
The command is ipv6 route, then the destination prefix with its prefix length, then the next hop:
`` R1(config)# ipv6 route 2001:db8:2::/64 2001:db8:12::2 ``
This says: packets for any address in 2001:db8:2::/64 go to the router at 2001:db8:12::2. Instead of a next-hop address you can name an exit interface, or give both (a fully specified route). If the next hop is a link-local address (one starting FE80::), you must give the exit interface too, because the same link-local address can exist on every link. Static routes have an administrative distance of 1 by default.
The default route: ::/0
For "everywhere else", you add a default route. In IPv6 it is written ::/0, said "double colon slash zero":
`` R1(config)# ipv6 route ::/0 2001:db8:12::2 ``
The /0 means zero network bits have to match, so ::/0 matches every IPv6 address. That's why it can catch everything else. A router always prefers the longest matching prefix (the most specific route), so the default route is only used when no more specific route matches. In show ipv6 route it shows up as S ::/0.
Try it yourself
In Cisco Packet Tracer (free with a Cisco Networking Academy account), connect two routers and a PC behind each one, and give every link an IPv6 address. Ping from one PC to the other: it fails. On both routers type ipv6 unicast-routing, then on each router add one static route to the far PC's network with ipv6 route. Ping again and it works. Now delete that route on one router and add ipv6 route ::/0 <next hop> instead: the ping still works, because the default route catches the destination. Use show ipv6 route to spot the S entries.
Good to know
- CCNA 3.3 covers configuring and verifying IPv4 and IPv6 static routing: default, network, host and floating static routes. EP45 covers IPv4 static and default routes, EP80 floating static routes.
- On Cisco IOS, IPv6 forwarding must be enabled with
ipv6 unicast-routing. - Static routes use
ipv6 route <prefix>/<length> <next hop>(or an exit interface, or both), with administrative distance 1 by default. - The IPv6 default route is
ipv6 route ::/0 <next hop>, shown asS ::/0inshow ipv6 route. - If the next hop is a link-local (
FE80::) address, the exit interface must also be given (a fully specified route), because link-local addresses are only unique on one link. ::/0has a prefix length of 0, so it matches every IPv6 address but loses to any longer matching prefix (longest prefix match, EP43).2001:db8::/32is the IPv6 documentation prefix (RFC 3849), used for all the example addresses here.
For CCNA learners
CCNA exam topic 3.3 asks you to configure and verify IPv6 static routing. Know that ipv6 unicast-routing must be on, the ipv6 route syntax with a next hop, an exit interface or both, that a link-local next hop needs the exit interface, and that ::/0 is the default route used only when nothing more specific matches.
Answer to the comment question
The 2001:db8::/32 route. The packet's destination 2001:db8:5::1 starts with the same first 32 bits as 2001:db8::/32 (2001:db8), so that route matches. The default route ::/0 matches it too, as it matches every address, but it has a prefix length of 0. The router picks the longest matching prefix, and /32 is longer (more specific) than /0, so the packet follows the 2001:db8::/32 route. The default route is used only when nothing more specific matches.
Test your knowledge
Quick quiz: "IPv6 static and default routes"
4 multiple-choice questions. Pick one answer for each, then check how you did.
Sources
- Cisco, "Implementing Static Routes for IPv6": the ipv6 route command, recursive and fully specified routes, and floating static routes
- Cisco, "Configure Static Routes for IPv6": enabling ipv6 unicast-routing, the ipv6 route syntax and checking routes with show ipv6 route static
- Study CCNA, "IPv6 routing: static routes explained and configured": enabling ipv6 unicast-routing and adding IPv6 static and default routes
- Network Lessons, "Link-local IPv6 next hop address needs exit interface": why a link-local next hop must be paired with an exit interface
- IETF, "RFC 3849: IPv6 Address Prefix Reserved for Documentation": 2001:db8::/32 is reserved for examples
Video transcript
How do you tell an IPv6 router: send everything else this way?
Static routes work just like in IPv4: to reach this network, send packets to that next router.
First, turn on IPv6 routing with ipv6 unicast-routing. Cisco routers don't route IPv6 until you do.
Then type ipv6 route, the network and its prefix length, then the next hop.
For everywhere else, use the default route: ::/0. Zero network bits, so it matches every IPv6 address.
It's only used when no more specific route matches.
A router has 2001:db8::/32, plus a default route. A packet heads to 2001:db8:5::1. Which route does it use? Comment your answer below!
That's your byte.
More from Network Bytes
- EP101"IPS: intrusion prevention"
- EP102"MAC address aging"
- EP106"Overlay, underlay and fabric"
- EP107"Security awareness and physical access control"