BGP address-family ipv4

in some of the configs in the lab i see the "address-family ipv4 unicast neighbor 1.1.1.1 activate" being used but if i remove it still work so how do i know when it is needed or not??? and what does the "neighbor 2.2.2.2 activate"

example config:

R1:

router bgp 65120

neighbor 2.2.2.2 remote-as 100

address-family ipv4 unicast

neighbor 2.2.2.2 activate

R2:

router bgp 65120

neighbor 1.1.1.1 remote-as 100

address-family ipv4 unicast

neighbor 1.1.1.1 activate

Comments

  • GabeGabe ✭✭

    BGP is a multi-family protocol (IPv4, IPv6, Multicast, VPN) so technically it is configured on a per-family basis. The reason IPv4 works with or without the address-family argument is because is the default address family so using plain configuration (no address-family IPv4) will still work for IPv4. The moment you activate another family, like address-family ipv6 for example, the address-family ipv4 argument will automatically show up in your BGP configuration.

    router bgp 1
     neighbor 1.1.1.1 remote-as 1

    will turn into:

    router bgp 1
     neighbor 1.1.1.1 remote-as 1
     address-family ipv4 unicast
      neighbor 1.1.1.1 activate

    as soon as you enable a second family address. Does that help?

  • JoeMJoeM ✭✭✭

    Hi Malsaie,

    It is the way Gabe explained.

    This is a good observation.  It will become important in later labs, especially during troublshooting or misconfigs.

     

    Try these different fresh configs and then note the results in the running config after:

            sh run | s bgp

     

    ===================

    router bgp <X>
             neighbor 1.1.1.1 remote-as X

    ===================

    router bgp <X>
        neighbor 1.1.1.1 remote-as X

        address-family ipv4 unicast

    ===================

    router bgp <X>
        NO bgp default ipv4
        neighbor 1.1.1.1 remote-as X

        address-family ipv4 unicast

    ===================

    router bgp <X>
        NO bgp default ipv4
        neighbor 1.1.1.1 remote-as X

        address-family ipv4 unicast
             neighbor 1.1.1.1 activate

  • As guys have suggested above, It is there in case of multi-address-family BGP configuration.

    As things are dual stack in V5 now, therefore i would think that it is best practice to have no bgp default ipv4

    all the time and configure it per family basis.

    Thanks

  • Thank you all, so if I didn't activate the neighbors under address family ipv4 and later on i enable ipv6 my ipv4 neighbors will be lost?

  • JoeMJoeM ✭✭✭

    Thank you all, so if I didn't activate the neighbors under address family ipv4 and later on i enable ipv6 my ipv4 neighbors will be lost?

    If you already have ipv4 neighbors, why would they be lost?

    Experiment with it.  Use the examples I gave above, and then enable IPv6.  These are easy tests to do.  Let us know what you discover.

  • GabeGabe ✭✭

    You do not need to activate the IPv4 family address as it is activated by default. The only time when you would need to do that is if you enter "no bgp default ipv4-unicast" as suggested by Murad above.

    When you enter that command, you change the default of "activate" to the non-default of "no activate" :

    router bgp 1
     bgp log-neighbor-changes
     no bgp default ipv4-unicast
     neighbor 1.1.1.1 remote-as 1
     !
     address-family ipv4
     exit-address-family

     

    So then you will have to go into the address family and activate it:

    router bgp 1
     bgp log-neighbor-changes
     no bgp default ipv4-unicast
     neighbor 1.1.1.1 remote-as 1
     !
     address-family ipv4
      neighbor 1.1.1.1 activate
     exit-address-family

     

    Best thing you can do is test it, JoeM gave you good test suggestions

Sign In or Register to comment.