When BGP peers set up their session between them, they send an OPEN message 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 |


