Use the explicit "address-family ipv4" in BGP configurations

If you use multiprotocol BGP (MP-BGP) in your network to support MPLS VPN, IPv6 or IP Multicast over BGP, it's best if you go all the way and configure an explicit ipv4 address family; the resulting BGP configuration is significantly easier to read and understand as the session-specific parameters are clearly separated from the routing-specific parameters and the IPv4 settings are nicely grouped in an explicit section.

To change the format of the BGP configuration, configure the IPv4 address family with the address-family ipv4 unicast router configuration command (the neighbor statements and other configuration settings pertinent to IPv4 configuration are automatically moved into the new address family) or manually activate a BGP neighbor for IPv4 route exchange with the neighbor activate router configuration command.To illustrate the differences between the traditional BGP configuration and the per-address-family configuration, consider a simple MPLS VPN+Internet setup. First the traditional approach:

router bgp 65000
template peer-policy Internal
send-community both
exit-peer-policy
!
template peer-session Internal
remote-as 65000
update-source Loopback0
exit-peer-session
!
no synchronization
bgp log-neighbor-changes
network 10.0.1.1 mask 255.255.255.255
neighbor 10.0.1.5 inherit peer-session Internal
neighbor 10.0.1.5 description PE-C(RR)
neighbor 10.0.1.5 inherit peer-policy Internal
no auto-summary
!
address-family vpnv4
neighbor 10.0.1.5 activate
neighbor 10.0.1.5 send-community extended
exit-address-family
... and the changed configuration after the address-family ipv4 command has been entered:
router bgp 65000
template peer-policy Internal
send-community both
exit-peer-policy
!
template peer-policy InternalV6
send-label
inherit peer-policy Internal 1
exit-peer-policy
!
template peer-session Internal
remote-as 65000
update-source Loopback0
exit-peer-session
!
bgp log-neighbor-changes
neighbor 10.0.1.5 inherit peer-session Internal
neighbor 10.0.1.5 description PE-C(RR)
!
address-family ipv4
no synchronization
network 10.0.1.1 mask 255.255.255.255
neighbor 10.0.1.5 activate
neighbor 10.0.1.5 inherit peer-policy Internal
no auto-summary
exit-address-family
!
address-family vpnv4
neighbor 10.0.1.5 activate
neighbor 10.0.1.5 send-community extended
exit-address-family

4 comments:

  1. but why, would it work under the old configuration.

    ReplyDelete
  2. Yes, the old configuration would work, but the new one is more explicit.

    The difference obviously only makes sense if you use more than just the IPv4 address family.

    ReplyDelete
  3. Suppose you have accidentally entered explicit address-family mode and want to return to your old BGP config? Do you know a hitless way to do that, or in your experience do you have to blow the BGP config away and start over? Thanks

    ReplyDelete

You don't have to log in to post a comment, but please do provide your real name/URL. Anonymous comments might get deleted.

Ivan Pepelnjak, CCIE#1354, is the chief technology advisor for NIL Data Communications. He has been designing and implementing large-scale data communications networks as well as teaching and writing books about advanced technologies since 1990. See his full profile, contact him or follow @ioshints on Twitter.