Output 101 : BGP AFI/SAFI

When BGP peers set up their session between them, they send an OPEN message possibly containing optional parameters.

One optional parameter is capabilities. Possible capabilities are Multiprotocol extensions, route refresh, outbound route filtering (ORF), and so on. When the BGP peers exchange the Multiprotocol extension capability, they exchange AFI and SAFI numbers and thus identify what the other BGP speaker is capable of.

IPv6 in BGP is implementated via Multi-Protocol BGP (MPBGP) (RFC 2283), as is MPLS and VPN’s through two new attributes: MP_UNREACH_NLRI and MP_REACH_NLRI. The first two values in these two attributes contain the Address Family Identifier (AFI) and the Subsequent Address Family Identifier (SAFI).

AFI Meaning
1 IPv4
2 IPv6
SAFI Meaning
1 Unicast
2 Multicast
3 Unicast and multicast
4 MPLS Label
128 MPLS-labeled VPN

If BGP is carrying IPv4 traffic, AFI equals 1, SAFI equals 1 for Unicast, or SAFI equals 4 for MPLS.
If BGP is carrying IPv6 traffic, AFI equals 2, SAFI equals 1 for Unicast, and SAFI equals 2 for multicast.

This is best seen during BGP session negotiation by using the “debug bgp all” command. Obviously use this command with caution and not on full-feed internet peerings.

In the above output you can clearly see these two BGP peers are capable of supporting IPv4 and IPv6 with Unicast and MPLS/VPN’s, along with Route-Refresh.