IOS BUG: IPv6 BGP having Next-Hop as IPv4

Border Gateway Protocol (BGP) is a routing protocol that is used to exchange routing information between routers in different autonomous systems (ASes) on the Internet. BGP supports the exchange of both IPv4 and IPv6 prefixes. When BGP is used to exchange IPv6 prefixes, it can be done via an IPv6 peering, which is a peering established using IPv6 connectivity, or via an IPv4 peering, which is a peering established using IPv4 connectivity.

IPv6 is the latest version of the Internet Protocol and has become increasingly important in ensuring the smooth functioning of IP-based networks. However, peering with IPv6 can sometimes be a challenge, particularly when dealing with Cisco IOS XE and XR devices. One of the bugs that can appear during IPv6 peering between these devices is the next-hop information advertised by IOS XE as an IPv4 address.

The IOS device advertises the next-hop to be IPv4-mapped-IPv6 address.

In IPv4-mapped IPv6 addresses, an IPv4 address is represented as an IPv6 address with the prefix “::ffff:”. The format of the IPv4-mapped address is “::ffff:a.b.c.d”, where “a.b.c.d” is the IPv4 address. The /96 at the end of the address represents the netmask, which in this case is a /96 prefix length, meaning that the first 96 bits of the address are used to identify the network, and the remaining 32 bits are used to identify the host.

IPv4-mapped IPv6 addresses are used to represent IPv4 addresses in an IPv6 environment. This allows for communication between IPv4 and IPv6 networks and helps in the transition from IPv4 to IPv6.

On IOS XR device, we see that this route is being learnt as valid IPv6 route, but with next-hop set as IPv4 address.

ASR9906#show bgp ipv6 unicast neighbors 2001:db8::1 received routes
Thu Feb  2 19:25:18.994 PKT
BGP router identifier 5.5.5.5, local AS number 65000 Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*> 2001:db8:4::101/128
                      203.82.48.118            0             0 64520 ?
*> 2001:db8:4::111/128
                      203.82.48.118            0             0 64520 ?

This issue arises when the IOS XE device incorrectly advertises an IPv4 address as the next-hop for an IPv6 prefix. This can lead to routing problems and prevent the packets from reaching their destination. To resolve this issue, network engineers need to ensure that the correct next-hop address is specified in the route-policy that is advertised by IOS XE device. This can be done by using the following command:

ipv6 prefix-list IPv6-OUT seq 10 permit 2001:db8:4::101/128
ipv6 prefix-list IPv6-OUT seq 20 permit 2001:db8:4::111/128

route-map manual-next-hop permit 10
 match ipv6 address prefix-list IPv6-OUT
 set ipv6 next-hop 2001:db8::1

router bgp 64520
 neighbor 2001:db8:1::1 remote-as 65000
  route-map manual-next-hop out

After the implementation of above policy on IOS XE device. We can see that the route is now correctly received on IOS XR device as shown below.

ASR9906#show bgp ipv6 unicast neighbors 2001:db8::1 received routes
Thu Feb  2 19:35:14.933 PKT
BGP router identifier 5.5.5.5, local AS number 65000 Status codes: s suppressed, d damped, h history, * valid, > best
              i - internal, r RIB-failure, S stale, N Nexthop-discard
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network            Next Hop            Metric LocPrf Weight Path
*> 2001:db8:4::101/128
                      2001:db8::1            0             0 64520 ?
*> 2001:db8:4::111/128
                      2001:db8::1            0             0 64520 ?

Conclusion

IPv6 peering is critical to ensure the smooth functioning of IP-based networks. However, peering with IPv6 can sometimes be challenging, especially when dealing with IOS XE and XR routers. In this blog post, we discussed the common problem and solution for resolving the IPv6 next-hop on IOS XE and XR routers. By following this solution, you can ensure that your IPv6 peering is properly configured and that your network is functioning smoothly.

The IPv6 next-hop is not required to be manually assigned on IOS XR or NX-OS
devices. When NX-OS router receives a prefix from IOS router, it receives the default inaccessible next-hop address. When IOS XR router receives a prefix from the IOS device, the
next-hop value is seen as the IPv4 address rather than as the inaccessible IPv6 address. In
either case, the IOS device is required to manually configure an IPv6 next-hop address for
the advertised prefixes.

Troubleshooting BGP A Practical Guide to Understanding and Troubleshooting BGP

Leave a Reply