IPv6 Protocol · Topic 3 of 3
IPv6 Routing Basics and Prefixes
Learn how RouterOS forwards IPv6 packets using prefixes and the longest prefix match, how to add static IPv6 routes, and how to read the route table.
- 4 min
- Routing uses the longest prefix match on 128 bit destinations.
- The IPv6 default route is
::/0. - Adding an address creates a connected route for its prefix.
What it is
IPv6 routing works like IPv4 routing, but every decision is made on prefixes and 128 bit addresses.
A router looks at the destination address of a packet, finds the best matching route, and sends the packet to the next hop. The route table holds prefixes, not individual hosts.
A prefix is the leading part of an address, written with a length such as 2001:db8:2::/64. The longer the prefix, the more specific the route.
How it works
The router builds a table from connected, static and dynamic routes, then applies the longest prefix match.
Where routes come from
Three sources fill the table:
- Connected routes: created automatically when you add an address with a prefix to an interface.
- Static routes: added by you with
/ipv6 route add. - Dynamic routes: learned from a routing protocol, or from a Router Advertisement.
Each address you configure creates a connected route for its prefix. The router can then reach every host on that prefix directly.
Longest prefix match
When several routes fit a destination, the one with the longest prefix length wins. A /64 beats a /48, and a /48 beats ::/0.
| Route | Matches 2001:db8:2::10? | Wins? |
|---|---|---|
2001:db8:2::/64 | Yes | Yes, longest match |
2001:db8::/32 | Yes | No |
::/0 | Yes | No |
2001:db8:3::/64 | No | No |
The default route ::/0 matches everything, so it is used only when nothing more specific exists. This is the IPv6 form of 0.0.0.0/0.
Static routes
A static route needs a destination prefix and a gateway. The gateway can be a global address or a link local address.
/ipv6 route add dst-address=2001:db8:2::/64 gateway=2001:db8:1::2
/ipv6 route add dst-address=::/0 gateway=2001:db8:ffff::1
A link local gateway is not unique, because every interface has the same fe80::/10 range. You must name the interface after the address with a percent sign.
/ipv6 route add dst-address=::/0 gateway=fe80::1%ether1
The %ether1 part tells the router which link to use when it resolves the neighbour.
Reading the table
/ipv6 route print
The output shows each destination, its gateway and a distance. A lower distance is preferred when two routes have the same prefix. Flags show whether a route is active, dynamic, connected or static.
If two routes for the same prefix come from different sources, the lower distance wins. Static routes use a distance of 1 unless you set another value. Dynamic protocols use their own defaults.
Router Advertisements and routes
A router that accepts Router Advertisements installs a default route toward the advertising router. The next hop is the link local address of that router. This is how a host or a client router learns its gateway without any static route.
Forwarding must be on
A device forwards IPv6 packets only when forwarding is enabled. The setting lives in /ipv6 settings and is called forward.
/ipv6 settings set forward=yes
Check a route with /ipv6 route print and confirm that the gateway is reachable. A route whose gateway is down does not forward traffic, even when the entry looks correct.
What to remember for the exam
Seven facts cover most questions on this topic.
- Routing uses the longest prefix match on 128 bit destinations.
- The IPv6 default route is
::/0. - Adding an address creates a connected route for its prefix.
- Static routes use
/ipv6 route add dst-address=... gateway=.... - A link local gateway must include the interface, as in
fe80::1%ether1. - A lower distance wins between routes for the same prefix.
/ipv6 settingshas aforwardoption that must allow forwarding.
A link local gateway without the %interface part is ambiguous, because the same range exists on every interface.
Common mistakes
These four mistakes appear often.
Omitting the interface on a link local gateway. The router cannot tell which link the address is on.
Using the IPv4 menu. IPv6 routes live in /ipv6 route, not in /ip route.
Forgetting the return route. The remote network needs a route back to your prefix, or replies never arrive.
Using a prefix that does not match the address plan. A route for 2001:db8:2::/48 also covers many /64 networks you may not mean to include.
Check yourself
Work through these three questions.
Which route does a router choose when several fit the destination?
It chooses the route with the longest prefix length, the longest prefix match.
How do you add an IPv6 default route through a link local gateway on ether1?
Use
/ipv6 route add dst-address=::/0 gateway=fe80::1%ether1, with the real gateway address.Where do you find IPv6 routes on RouterOS?
They are in
/ipv6 route, which is separate from the IPv4/ip routemenu.
Topic 3 of 3 in IPv6 Protocol
Test yourself on IPv6 Protocol
The full MikroTik MTCIPv6E question bank has 486 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by MikroTik. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.