BGP Address Family Identifiers (AFI) and Subsequent address family identifiers (SAFI)

BGP add

Address family identifier is shared among the BGP peers during the BGP OPEN message as a part of BGP’s Multiprotocol capabilities extension. It is used to describe the network layer protocol associated with the network addresses that follow it during the BGP UPDATE message with the NLRI.

Subsequent Address family identifier provided additional information about the type of NLRI being advertised.

2Here is capture to identify the AFI and SAFI information as shared in the BGP OPEN message.


As a part of optional parameters the BGP speaker sends the capabilities containing Multiprotocol capabilities as well as route refresh capabilities.

In case of multiple address families there will be more than one optional parameter fields.

Address family IPv4 unicast (AFI 1 SAFI 1)

This address family is a default AFI ,however in order to be interoperable with the older version of BGP which were not multiprotocol supported ,just defining the neighbor would mean IPv4 unicast NLRI would be exchanged between the peers.

Address family IPv6 unicast (AFI 2 SAFI 1)

This is used to share information between to IPv6 BGP speakers, the neighbors are defined using IPv6 peer address and they share information of the NLRI containing IPv6 prefixes.

Address family IPv4 labelled unicast (AFI 1 SAFI 4)

This is also known as Labeled BGP. Traditionally LDP/RSVP is used to assign labels to the IGP prefixes, however for some cases such as inter AS VPN, labelled BGP would assign labels to the prefixes to the peers.

IPv6 labelled unicast (AFI 2 SAFI 4)

Most commonly used in 6PE, where IPv6 prefixes have to transported over IPv4 only MPLS network. The two PE will have IPv6 BGP peering over IPv4 labelled session.

In below example PE router R2 is receiving the IPv6 prefix information from its peer (R5)

Please note the next hop has ::FFFF attached to the IPv4 address of R5 to keep the route in the IPv6 routing table. Label 28 (Bottom table) is assigned by the router R5 for the prefix 2001::6:6:6:6/128 and label

R2#sh bgp ipv6 unicast 2001::6:6:6:6/128
Paths: (1 available, best #1, table default)
Advertised to update-groups:
 ::FFFF: 4) from
 Origin IGP, metric 0, localpref 100, valid, internal, best
 mpls labels in/out nolabel/28
R2#sh mpls forwarding-table detail
 Local      Outgoing   Prefix           Bytes Label   Outgoing   Next Hop
 Label      Label      or Tunnel Id     Switched      interface
 27         26       0             Fa0/0.23
 MAC/Encaps=18/22, MRU=1500, Label Stack{26}
 CA071AC40000CA0517C80000810000178847 0001A000
 No output feature configured

VPNV4 unicast

This BGP address family is the most common the MPLS VPNs .The BGP peers with VPNV4 unicast address family will share the prefixes exported from the locally connected VRFs. However these prefixes are shared by assigning labels to the prefixes using MPBGP and distinguishing the prefixes using Route distinguisher prefix.

R3-ASBR#show ip bgp vpnv4 all         
BGP table version is 31, local router ID is codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,x best-external,a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incompleteRPKI validation codes: V valid, I invalid, N Not found                 
Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 
*>i           0    100      0     ?
Route Distinguisher: 
*>i           0    100      0     ?
Route Distinguisher: 
*>          0    200            i 
*>          0    200            i
Route Distinguisher: 
*>              200       0    200 i 
*>              200       0    200 i

VPNV6 unicast

VPNV6 address family is used to carry VRF aware IPv6 information over MPLS -6VPE.Difference between 6PE and 6VPE is that the latter is VRF aware. The BGP peer assigns labels to the customer prefixes using VPNV6 also adds a prefix for :FFFF against the next hop address in the BGP NLRI information ,this is used to maintain the IPv6 information throughout the updates.

6VPE2# show bgp vpnv6 unicast vrf CUST1 ABCD::1/128
BGP routing table entry for [1:1]ABCD::1/128, version 30
Paths: (1 available, best #1, table CUST1)
Advertised to update-groups:
::FFFF: (metric 3) from (
Origin IGP, metric 0, localpref 100, valid, internal, best
Extended Community: RT:1:1
mpls labels in/out nolabel/20

IPv4 Multicast

This is used mainly to create separate paths for unicast and multicast traffic, by populating the mroute table with the path where PIM is enabled.


This address family is my favorite these days! Normally the two BGP peers over VPNV4/VPNV6 will advertise information of all the prefixes for all the VRFs (and route targets) they store in their BGP routing table .For instance PE1 has prefixes corresponding to VRF-A,VRF-B and VRF-C, however its BGP-VPNV4 peer PE2 has configured only the VRF-A for import.In this case PE1 would be advertising prefixes corresponding to VRF-A,B and C to PE2 ,however PE2 will accept only VRF-A prefixes in its BGP routing table.This causes unnecessary route advertisement on PE1 part even though those routes are never used. RTFilter comes in handy in such cases ,where in the BGP update message a BGP speaker will let its peer know ,what all route-targets it is interested in importing. This address family is very useful in case of Route-reflectors being used in the networks and reduces the CPU usage on the route reflector.


One thought on “BGP Address Family Identifiers (AFI) and Subsequent address family identifiers (SAFI)

  1. Pingback: BGP AFI / SAFI –

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s