When to use BGP address-family?


When working on Multiprotocol BGP I have come across below article by Peter Paluch on https://supportforums.cisco.com/thread/2144197 which perfectly explains what are and why we use  BGP address families.

The BGP, as you surely know, has a multi-protocol capability – in a single session, it is capable of carrying information about diverse routed protocols (IPv4 Unicast, IPv4 Multicast, IPv6 Unicast, IPv6 Multicast, VPNv4, CLNP), in BGP’s parlance called “address families”. With BGP being a true multiprotocol routing protocol, however, you need some means to tell BGP which address families should be exchanged with a particular neighbor. We are accustomed to the fact that if we define an IPv4 neighbor, we are planning to exchange IPv4 routes with that neighbor – but why should that actually be a rule? Why should we make hasty assumptions about the address family just because the address of the neighbor is from a particular family itself?

This is the point behind diverse address-family commands. Defining a neighbor under a particular address family means that we want to exchange routes from the particular address family with that neighbor. Not having a neighbor listed under a particular address family means that we are not planning to exchange information from that address family with that neighbor.

Now, the address-family ipv4 declares neighbors with whom we want to exchange normal IPv4 unicast routes. This may be surprising because to exchange IPv4 routes with a neighbor, it is sufficient to simply define that neighbor by its address. The fact is that for backward compatibility with older BGP versions that have not been multiprotocol-capable, the BGP implicitly assigns all defined neighbors to an invisible address-family ipv4 section. In other words, as soon as you define a neighbor, it is automatically being added to an invisible address-family ipv4 section so that you don’t have to do it manually.

You can change it, however. First of all, if you enter the BGP configuration and issue the command bgp upgrade-cli you will find out that the BGP configuration has been fully converted to the address family style of configuration. Outside any address-family stanzas, only the basic neighbor settings are configured like their addresses, AS numbers, update sources. However, all remaining per-address-family commands will be automatically moved into address-family stanzas. The behavior or operations of BGP do not change with this new style of configuration, only the configuration format is changed.

Furthermore, if you enter the no bgp default ipv4-unicast command in the BGP configuration, you will prevent BGP from automatically assigning each newly defined neighbor into address-family ipv4 section. You will then be required to add every defined neighbor to each intended address family automatically – it won’t be done automatically for you anymore.

So to wrap it up – the address-family ipv4 is in fact an omnipresent section in the BGP configuration but for backward compatibility purposes, it is not visible by default. However, the configuration can be converted to a strict per-address-family configuration, and in fact, I would recommend that for all new deployments.”

Below is the config from one device where we can see 2 different output bur performing exactt same function:

router bgp 60001
no synchronization
bgp log-neighbor-changes
network 92.1.80.0 mask 255.255.255.0
network 92.1.81.0 mask 255.255.255.0
network 92.1.82.0 mask 255.255.255.0
network 92.1.83.0 mask 255.255.255.0
network 100.100.100.0 mask 255.255.255.0
network 150.100.12.0 mask 255.255.255.0
network 200.0.0.1 mask 255.255.255.255
neighbor 100.100.100.100 remote-as 7018
neighbor 100.100.100.100 local-as 22222
neighbor 150.100.12.2 remote-as 109
neighbor 150.100.12.2 route-map TASK out
no auto-summary

—————————————————–

router bgp 60001
bgp log-neighbor-changes
neighbor 100.100.100.100 remote-as 7018
neighbor 100.100.100.100 local-as 22222
neighbor 150.100.12.2 remote-as 109
!
address-family ipv4
neighbor 100.100.100.100 activate
neighbor 150.100.12.2 activate
neighbor 150.100.12.2 route-map TASK out
no auto-summary
no synchronization
network 92.1.80.0 mask 255.255.255.0
network 92.1.81.0 mask 255.255.255.0
network 92.1.82.0 mask 255.255.255.0
network 92.1.83.0 mask 255.255.255.0
network 100.100.100.0 mask 255.255.255.0
network 150.100.12.0 mask 255.255.255.0
network 200.0.0.1 mask 255.255.255.255
exit-address-family

Advertisements

About ccie4all
Hello, and welcome to the first post of my CCIE blog This blog has got one simple goal and that is to improve our skills in Cisco Networking field so we can become best engineers on a job market. Wordpress Blog https://ccie4all.wordpress.com/ information about the changes made to Gns3 BGP , MPLS and R&S CCIE labs. In order to access and download all provided materials and receive important updates from Gns3 BGP , MPLS and R&S CCIE labs under GNS3 tab in the main header please go ahead and subscribe to https://ccie4all.wordpress.com/ ! All other posts have not been affected and can be accessed at any given time. Enjoy ! Tom

6 Responses to When to use BGP address-family?

  1. jay says:

    Great article Tom.
    If i understood that correctly, bgp allows us to configure neighbors and other parameters in various address family stanzas.

    Main stanzas are:

    address fmaily ipv4
    address family vpnv4
    address family ipv4 vrf

    I had seen all three in my work network. I understand that address family ipv4 vrf is used to configure bgp and its parameters with CE.

    address family vpnv4 is used to d define bgp neighbors to to exchange vpnv4 routes with.

    address family ipv4 is basically the representation of global bgp peers.

    Is this understanding correct. Here is an example config to prove the point:

    regards

    • ccie4all says:

      Hello Jay !

      The big thing is that BGP is an application, not an actual routing protocol. This application being able to support IPv4 (default), IPv6, multicast sources of both IPv4 or IPv6, NSAP, VPNv4, VRFs, etc. we need some method to separate this information and that’s where address families come into play and the good example are the VRFs.

      address family ipv4 is the default “family” which can be seen whenever we start BGP process and start configuring neighbours
      address family vpnv4 is mostly used with MPLS where we need to activate specific neighbour (not all neighbours unless there is a requirement) who also will be responsible to do label switching and redistribution etc …
      address family ipv4 vrf is simply used to separate a routing table from the global table to the Virtual one which is responsible for each customer routes.

      Address families can get confusing and I must say they do require relatively long hours to fully understand them but on a flip site once you’ve got it under control it then becomes so much easier to show up to work ,preferably ISP as BGP is hardly ever used in some private organizations, and read a routing table and differentiate what routes go where and why.

      Enjoy your address family journey and best of luck !

      Tom

  2. Naveen says:

    This is indeed a great explanation. I just have one small lingering doubt w.r.t to ipv4 address family…

    What is the need to explicitly define an ipv4 address family (automatic or otherwise)?

    for ex …If you are adding a static route, you just mention ip route…

    you do not mention ipv4 route….

    meaning ipv4 is omnipresent…in the same way…there MUST NOT be any ipv4 address families…at ALL…

    whatever I define directly under router bgp process MUST BE TAKEN AS ipv4 address family (no need to auto add this)…

    Meaning ipv4 address family pre-exists….

    So my question is…I disable bgp default ipv4-unicast and WILL NOT MANUALLY add the ipv4 address family..it must still work on the global level…please clarify…

    Cisco could have reduced the bgp cmd set…

    Also as a second q: on a edge to edge MPLS cloud bgp config…do we need to specify remote bgp neighor globally and again in ipv4? (we need to specify in vpnv4 for sure )…

  3. achinnac says:

    it would be great to give credit to article owner and specified the source!.

  4. achinnac says:

    https://supportforums.cisco.com/thread/2144197

  5. Pingback: 3.7.f Implement and troubleshoot multiproctocol BGP | ccie or die

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: