BGP for IPv6 fundamentals
Explain how multiprotocol BGP carries IPv6 routes and next hops (RFC 4760, RFC 2545). Configure eBGP and iBGP sessions for IPv6 on FRR, with MikroTik RouterOS and VyOS equivalents. Design iBGP with route reflectors (RFC 4456) and explain next-hop handling. Explain extended next hop (RFC 8950), 4-byte ASNs (RFC 6793) and the RFC 8212 default-deny rule.
Take the quiz · pass mark 70% · 9 questions
Explanation
BGP (RFC 4271) exchanges routes between autonomous systems and, inside a provider, carries customer and Internet routes that are too many or too policy-heavy for the IGP. IPv6 support comes from the multiprotocol extensions, so the protocol and the best-path rules you know from IPv4 still apply.
Multiprotocol BGP (RFC 4760)
Classic BGP carries only IPv4 routes. RFC 4760 adds two path attributes:
- MP_REACH_NLRI (type 14): the address family (AFI 2 = IPv6, SAFI 1 = unicast), the next hop and the reachable prefixes
- MP_UNREACH_NLRI (type 15): withdrawn prefixes for that family
Both sides announce the families they support with the Multiprotocol capability in the OPEN message. An address family is used only if both peers announce it.
The address family of the routes is independent of the address family of the session: IPv6 routes can be carried over a session between IPv4 addresses and the other way round. The common practice is one session per family (IPv6 routes over IPv6 transport), which keeps failures independent and makes troubleshooting clearer. Note that the BGP Router ID is still a 32-bit number, so set it explicitly on IPv6-only routers.
Next hops (RFC 2545)
The IPv6 next hop in MP_REACH_NLRI is either:
- 16 bytes: a global address, or
- 32 bytes: a global address followed by a link-local address
The link-local is included only when the peer shares a link with the advertised next hop (typically an eBGP session on a point-to-point or IXP link). Implementations then choose which one to install. FRR prefers the link-local by default when it is present; nexthop prefer-global in the IPv6 address family changes that.
eBGP and iBGP
- eBGP peers are normally directly connected and peer on the link addresses.
- iBGP peers peer between loopbacks (
update-source lo), which the IGP (L4.02, L4.03) makes reachable. iBGP does not change the next hop, so a route learned from an external peer still has the external link's address. Either carry the external links in the IGP or set next-hop-self on the border routers towards iBGP peers. Most providers use next-hop-self.
Route reflection (RFC 4456)
iBGP routers do not pass iBGP-learned routes to other iBGP peers, so every iBGP router must peer with every other: n(n−1)/2 sessions. With 10 routers that is 45 sessions, and each new router needs a session to all the others.
A route reflector (RR) may reflect routes between its clients. Each client peers only with the RRs. To prevent loops, the RR adds:
- ORIGINATOR_ID: the Router ID of the router that first injected the route into the AS. A router drops a route carrying its own ID.
- CLUSTER_LIST: the cluster IDs of the RRs it passed. An RR drops a route carrying its own cluster ID.
Use two RRs for redundancy. With 2 RRs and 8 clients, each client has 2 sessions and the RRs peer with each other: 8 × 2 + 1 = 17 sessions instead of 45. RRs do not change the next hop, so next-hop-self on the border routers still matters.
Extended next hop (RFC 8950)
RFC 8950 (which obsoletes the original 2009 specification) lets BGP advertise IPv4 routes with an IPv6 next hop. The peers agree with the Extended Next Hop Encoding capability (code 5). This allows IPv4 routing over links with no IPv4 addresses, and is the basis of FRR's BGP unnumbered: neighbor eth1 interface remote-as external peers over the interface's link-local address and turns on extended next hop automatically.
4-byte ASNs (RFC 6793)
ASNs are 32 bits. Old speakers that only understand 2-byte ASNs see AS_TRANS (23456) in place of a 4-byte ASN; the real path is carried in AS4_PATH. A 4-byte ASN can also be written in asdot notation: high 16 bits, a dot, low 16 bits. ictNetworks' AS65550 (a documentation ASN from RFC 5398) is 65550 = 1 × 65536 + 14, so 1.14 in asdot.
No policy, no routes (RFC 8212)
RFC 8212 requires that an eBGP speaker neither accepts nor sends routes on an eBGP session until a policy is configured. This prevents accidental route leaks. FRR implements it as bgp ebgp-requires-policy, on by default: without an inbound and outbound route-map, show bgp ipv6 summary shows (Policy) instead of prefix counts. Configure explicit route-maps; do not turn the protection off.
Configuration
FRR (ISP-A border router, AS64496). On FRR, no bgp default ipv4-unicast stops IPv4 unicast being activated automatically for every neighbour (defaults differ between the traditional and datacenter profiles, so state it explicitly).
ipv6 route 2001:db8:1000::/36 blackhole
!
ipv6 prefix-list ISPA-OUT seq 10 permit 2001:db8:1000::/36
route-map ISPB-IN permit 10
route-map ISPB-OUT permit 10
match ipv6 address prefix-list ISPA-OUT
!
router bgp 64496
bgp router-id 192.0.2.1
no bgp default ipv4-unicast
neighbor 2001:db8:f000:1::b remote-as 64497
neighbor IBGP peer-group
neighbor IBGP remote-as internal
neighbor IBGP update-source lo
neighbor 2001:db8:1000::10 peer-group IBGP
!
address-family ipv6 unicast
network 2001:db8:1000::/36
neighbor 2001:db8:f000:1::b activate
neighbor 2001:db8:f000:1::b route-map ISPB-IN in
neighbor 2001:db8:f000:1::b route-map ISPB-OUT out
neighbor IBGP activate
neighbor IBGP next-hop-self
exit-address-family
network advertises the prefix only if exactly that prefix is in the routing table, which the discard route provides (L4.01). ISPB-IN accepts everything here for simplicity; L4.05 adds real filters. On the route reflector, add neighbor IBGP route-reflector-client in the address family and set bgp cluster-id.
MikroTik RouterOS v7:
/routing/bgp/connection add name=to-ispb as=64496 remote.address=2001:db8:f000:1::b remote.as=64497 \
local.role=ebgp afi=ipv6 output.network=ispa-agg input.filter=ispb-in output.filter-chain=ispb-out
Parameter names have changed during v7 (newer releases also want an instance), so check the manual for your version.
VyOS 1.4/1.5 (older releases put the ASN in the path, protocols bgp 64496):
set protocols bgp system-as 64496
set protocols bgp parameters router-id 192.0.2.1
set protocols bgp neighbor 2001:db8:f000:1::b remote-as 64497
set protocols bgp neighbor 2001:db8:f000:1::b address-family ipv6-unicast route-map import ISPB-IN
set protocols bgp neighbor 2001:db8:f000:1::b address-family ipv6-unicast route-map export ISPB-OUT
ictNetworks scenario
ictNetworks (AS65550) originates 3fff:a00::/32 from its two border routers, each with a discard route for the /32. It has transit from ISP-A (AS64496) and ISP-B (AS64497). Inside, the core routers are route reflectors and the border, PoP and BNG routers are clients. Customer /48s and BNG /40s are carried in iBGP, and only infrastructure is in the IGP.
Drawing diagram…
Worked examples
Example 1: Session counts
ISP-A has 10 BGP routers. A full mesh needs 10 × 9 ÷ 2 = 45 sessions. With 2 route reflectors and 8 clients: each client peers with both RRs (16 sessions) and the RRs peer with each other (1): 17 sessions.
Example 2: Next-hop length
a-br1 advertises 2001:db8:1000::/36 to b-br1 over their shared link. The next hop field contains the global address 2001:db8:f000:1::a and a-br1's link-local address on that link, so the Length of Next Hop Network Address is 16 + 16 = 32 bytes. Over a multihop session between loopbacks it would be 16.
Example 3: asdot
65550 ÷ 65536 = 1 remainder 14, so AS65550 is 1.14 in asdot. A 2-byte-only router sees AS_TRANS, 23456, in its place.
Lab
Goal: Build eBGP and iBGP for IPv6 with route reflectors, and observe next hops and the RFC 8212 rule.
You need: containerlab with FRR nodes a-br1, a-rr1, a-rr2, a-pe1, a-pe2 (ISP-A, AS64496, OSPFv3 or IS-IS as the IGP for loopbacks 2001:db8:1000::n/128) and b-br1 (ISP-B, AS64497, originating 2001:db8:2000::/36). The interconnect is 2001:db8:f000:1::a/127 (ISP-A) and ::b/127 (ISP-B).
- Configure the eBGP session with
no bgp default ipv4-unicastand activate IPv6 unicast, but without route-maps. Show thatshow bgp ipv6 unicast summaryreports(Policy)and no routes are exchanged. Add the route-maps and show the routes. - Capture the eBGP UPDATE and identify MP_REACH_NLRI (type 14), AFI 2, SAFI 1, and a next-hop length of 32 with the global and link-local next hops.
- Configure iBGP from loopbacks with a-rr1 and a-rr2 as route reflectors (same cluster ID) and the other routers as clients. On a-pe1 show ISP-B's /36 with ORIGINATOR_ID and CLUSTER_LIST (
show bgp ipv6 unicast 2001:db8:2000::/36). - Remove next-hop-self on a-br1 and show that a-pe1 has the route but it is not valid (next hop unreachable) unless the interconnect is in the IGP. Restore next-hop-self.
- Replace the eBGP session with BGP unnumbered (
neighbor eth1 interface remote-as external), activate IPv4 unicast too, and advertise192.0.2.0/24from ISP-A. On b-br1 show the IPv4 route with an IPv6 link-local next hop and the extended next hop capability inshow bgp neighbors.
What to submit: configurations, the summary before and after policy, the annotated UPDATE, route details with reflection attributes, the next-hop-self test and the RFC 8950 evidence.
Summary
- MP-BGP carries IPv6 in MP_REACH_NLRI and MP_UNREACH_NLRI (attributes 14 and 15), AFI 2, SAFI 1.
- The IPv6 next hop is 16 bytes (global) or 32 bytes (global plus link-local, on a shared link).
- iBGP peers between loopbacks, needs next-hop-self (or IGP routes to the external links) and a full mesh or route reflectors.
- Route reflectors use ORIGINATOR_ID and CLUSTER_LIST to prevent loops.
- RFC 8950 (not its obsolete 2009 predecessor) carries IPv4 routes with IPv6 next hops; it powers BGP unnumbered.
- 4-byte ASNs use AS_TRANS 23456 towards old speakers; RFC 8212 means no eBGP routes without policy.
- Next lesson (L4.05): Internet routing policy and RPKI.
Quiz imported · 9 questions · pass mark 70%. Lab questions are not auto-marked.