Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

When to use BGP address-family?

I commonly see BGP configured on a provider (P/PE) router like this (this is a real router snippet just anonymised);

router bgp 12345

neighbour 1.1.1.1 remote-as 12345     ! iBGP peer

address-family ipv4

neighbour 1.1.1.1 remote-as 12345     ! iBGP peer

address-family vpnv4

neighbour 1.1.1.1 remote-as 12345     ! iBGP peer

address-family ipv4 vrf Customer1

neighbour 10.0.0.1 remote-as 67890    ! eBGP peer

  • I understand the CE peering defined under "address-family ipv4 vrf Customer1" because we are placing their routes into that VRF
  • I understand that "address-family vpnv4" is used to define provider iBGP peers to which other CE's are going to be attached, carrying this customer VRF
  • Finally, I understand that a provider router is an iBGP peer so it is defined directly under "router bgp 12345"

What is the need for "address-family ipv4" (without vrf) here, or ever?

What does it provies that "normal" neighbour definitions (those directly under "router bgp 12345") and vpnv4 neighbour definitions, don't provide?

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

When to use BGP address-family?

Hello,

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.

Please feel welcome to ask further!

Best regards,

Peter

20 REPLIES
Cisco Employee

When to use BGP address-family?

Hello,

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.

Please feel welcome to ask further!

Best regards,

Peter

New Member

When to use BGP address-family?

What an absolutely brilaint answer! You have clearly explained exactly what I wanted to know. Thank you very much

New Member

When to use BGP address-family?

I have to say this answer is excellent. It completely removed my confusion about BGP address-family configurations.

When to use BGP address-family?

Very helpful.

Thanks

When to use BGP address-family?

hi peter,

was searching on the net for this topic and your explanation is perfect.

it really helped me understand the concept.

Cisco Employee

Re: When to use BGP address-family?

Hi John,

Thank you... There is no better satisfaction than knowing I could be of help.

Best regards,

Peter

New Member

Thank you for the explanation

Hi Peter,

Thank you for the explanation.

--

I would have one question please regarding the following config (taken from here):

--

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

..

--

Can you please clarify: is there a reason we don't put all the config under address-family ipv4 then ?

Thank you.

Regards,

Adrian

Cisco Employee

Hi Adrian,Can you please

Hi Adrian,

Can you please clarify: is there a reason we don't put all the config under address-family ipv4 then ?

This is because in BGP, there are essentially two different aspects of having a neighbor:

  1. Who the neighbor is and how shall we talk to it
  2. What content shall be exchanged with this neighbor

Notice that the neighbor's identity (who the neighbor is), that is, its address, autonomous system, etc. - these are qualities that do not depend on the address family exchanged with the neighbor (the content). Therefore, after migrating to the address-family style of BGP configuration, the definition of neighbors, their ASNs, update-sources, etc. is still maintained in the global level of the BGP process config because for a neighbor, all these settings are the same for every address-family the neighbor is added to. Also keep in mind that for a single neighbor, only a single BGP session is established, no matter how many address families the neighbor belongs into.

Please feel welcome to ask further!

Best regards,
Peter

New Member

Excellent explanation! Thank

Excellent explanation! Thank you very much Peter..

Kind regards,

Adrian

New Member

thanx Peter, that answer was

thanx Peter, that answer was pretty clear to solve my doubt too!

Cisco Employee

Hi,

Hi,

You are welcome!

Best regards,
Peter

New Member

Greatly described. 

Greatly described. 

I have small query. 

What is the meaning of below command where only address-family ipv4 command is configured but no neighbor is mentioned on PE router:

address-family ipv4
maximum-paths 2
exit-address-family

Thanks,

Pruthvi

Cisco Employee

Hi Pruthvi,

Hi Pruthvi,

Such configuration has no impact on the current operation of the router. The router is basically told that if there ever are neighbors with whom plain unicast IPv4 routes are exchanged, then the BGP is allowed to use up to two equal-cost paths. However, at the moment, there are no such neighbors, and so this configuration has no routes to apply to.

Best regards,
Peter

New Member

Re: When to use BGP address-family?

Very clear, thanks Peter.

New Member

When to use BGP address-family?

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

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

for ex ...If you are adding a static route, you just meniton ip route...

you do not mention ipv4 route....

meaning ipv4 is ominipresent...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 quesiton 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 Employee

Re: When to use BGP address-family?

Hi Naveen,

Thank you for joining.

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

for ex ...If you are adding a static route, you just meniton ip route...

you do not mention ipv4 route....

Regarding the non-BGP-related commands such as ip route, ip address, ip summary-address, ip access-group, ip proxy-arp, ip split-horizon etc., the use of the ip keyword is purely historical. All these commands have been supported in IOS long before IPv6 existed, so there was no reason to force the "v4" into the ip keyword, as the IPv4 was the only IP version in use. And today, no one is going to even suggest to change the syntax of all existing ip commands to ipv4 - it would definitely case backward compatibility issues (you would still have to support the ip keyword to process old configurations gracefully), and it would definitely alienate many users who are accustomed to use ip for IPv4, and ipv6 for IPv6.

Meaning ipv4 address family pre-exists....

With the non-BGP ip commands, it is not about the pre-existence of the IPv4 address family, rather, it is about accepting the very simple fact that the ip commands have been created and added to IOS and widely used before IPv6 came to being.

The pre-existence of the IPv4 address family as discussed here is related exclusively to BGP configuration.

So my quesiton 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...

I believe you are confusing the BGP configuration with use of IPv4/IPv6 in global configuration. All discussion about the address families in this thread were relevant and related only to BGP configuration in particular. Other parts of IOS configuration are not affected by it.

I am not sure if this actually clarifies your question but I needed to make sure you understand this first. If you still have doubts please feel welcome to ask further!

Best regards,

Peter

New Member

When to use BGP address-family?

I happened to run across this post and couldn't be more thankful to Peter for such an amazing explanation!

New Member

Wow what a great explanation!

Wow what a great explanation! Thank you sir!


 

New Member

Thank you Peter:)

Thank you Peter:)

New Member

Great answer!

Great answer!

55195
Views
169
Helpful
20
Replies
CreatePlease login to create content