Dec 27 2008
AFIs and SAFIs
BGP uses Open messages to negotiate BGP sessions. These Open messages have optional parameters which allow additional capabilities to be negotiated during setup.
If you want to run anything other than IPv4 unicast then you will have to configure BGP to advertise its additional capabilities i.e. Multi-Protocol extensions (AFI/SAFI) during initial setup.
As an example you may want to run IPv4 multicast, VPNv4 or even IPv6. The table below shows the different AFI and SAFI values. The AFI and SAFI values combine to form pairs which are used during the BGP negotiation phase. Ie if the BGP speaker wants to negotiate IPv4 multicast, then it advertises capability 1/2.
| AFI | SAFI | TYPE |
| IPv4(1) | Unicast(1) | IPv4 Address |
| IPv4(1) | Multicast(2) | IPv4 Address |
| IPv4(1) | VPN(128) | VPNv4 Address |
| IPv6(2) | Unicast(1) | IPv6 Address |
Lets suppose you wanted to run an MP-iBGP session between two PE routers to advertise IPv4 Unicast and IPv4 VPN(VPNv4) routes. You would need to negotiate AFI/SAFI pairs 1/1 and 1/128 during the initial BGP setup phase. If after the BGP session is established you would like to add an additional AFI/SAFI pair then BGP will have to renegotiate its capabilities which unfortunately means tearing down the original session. Some folks refer to this as BGP fate sharing.
Anyhow, lets see this in action. Consider the topology below.
Watch the video below or alternatively click here to download it and watch it on your iPod.
The commands used to configure the above can be found below.
R1
!
ipv6 unicast-routing
!
interface FastEthernet1/0
description "Interface connected to R2"
ip address 10.0.0.1 255.255.255.252
!
router ospf 1
log-adjacency-changes
network 1.1.1.1 0.0.0.0 area 0
network 10.0.0.0 0.0.0.3 area 0
!
router bgp 1
no bgp default ipv4-unicast
neighbor 2.2.2.2 remote-as 1
neighbor 2.2.2.2 update-source Loopback0
!
address-family ipv4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community
exit-address-family
!
address-family vpnv4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community extended
exit-address-family
!
address-family ipv6
neighbor 2.2.2.2 activate
exit-address-family
R2
!
ipv6 unicast-routing
!
interface FastEthernet1/0
description "Interface connected to R1"
ip address 10.0.0.2 255.255.255.252
!
router ospf 1
log-adjacency-changes
network 2.2.2.2 0.0.0.0 area 0
network 10.0.0.0 0.0.0.3 area 0
!
router bgp 1
no bgp default ipv4-unicast
neighbor 1.1.1.1 remote-as 1
neighbor 1.1.1.1 update-source Loopback0
!
address-family ipv4
neighbor 1.1.1.1 activate
neighbor 1.1.1.1 send-community
exit-address-family
!
address-family vpnv4
neighbor 1.1.1.1 activate
neighbor 1.1.1.1 send-community extended
exit-address-family
!
address-family ipv6
neighbor 1.1.1.1 activate
exit-address-family
