Routing

Expand all | Collapse all

BGP communities - AND or OR operations

Jump to Best Answer
  • 1.  BGP communities - AND or OR operations

    Posted 09-03-2013 04:09

    Hello,

    It is not very clear whether an OR or AND operation perform when there are multiple bgp communities are used in a term and each one has more than one member (example below). Appreciate if someone can clarify it.

     

    Thanks

     

     

    set policy-options policy-statement My-Term term term 40 from community community-111
    set policy-options policy-statement My-Term term term 40 from community community-112
    set policy-options policy-statement My-Term term term 40 from community community-113
    set policy-options policy-statement My-Term term term 40 then metric 20
    set policy-options policy-statement My-Term term term 40 then community set community-no-export
    set policy-options policy-statement My-Term term term 40 then accept

     

    set policy-options community community-111 members 111:222
    set policy-options community community-111 members 111:333

     

    set policy-options community community-112 members 112:222
    set policy-options community community-112 members 112:333

     

    set policy-options community community-113 members 113:222
    set policy-options community community-113 members 113:333


    #JUNOS
    #BGP
    #community


  • 2.  RE: BGP communities - AND or OR operations
    Best Answer

    Posted 09-03-2013 05:55

    Hi,

     

    It is really a tricky question, and same came to my mind while I was preparing for my JNCIE Lab exam.

     

    Community member under the same community name will be AND operation, and different communities name specified in the policy will be in the OR operation. In summary.

     

    In summary your policy will be behave like:

     

    If {(111:222 AND 111:333)OR(112:222 AND 112:333)OR(113:222 AND 113:333)}

    then {

    accept

    metric 20

    community-no-export

    }

     

    Regards

    Satinder Singh

     



  • 3.  RE: BGP communities - AND or OR operations

    Posted 09-03-2013 08:45

    Thanks Satinder.



  • 4.  RE: BGP communities - AND or OR operations

    Posted 02-05-2019 13:42

    Hi Satinder,

     

    Does the router perform an OR or AND operation, with the below syntax? 

     

    set policy-options community community-111 members "111:222 111:333"



  • 5.  RE: BGP communities - AND or OR operations

    Posted 02-05-2019 19:06

    Router will perform AND operation. If you need OR operation you can use syntax given below:

    set policy-options community community-111 members "111:222|111:333"

     

     



  • 6.  RE: BGP communities - AND or OR operations

    Posted 02-06-2019 11:32

    Thank you for the response.

     

    Quick question - if i have 3 communites like "111:111 111:222 111:333"

     

    Does the router look at the order of communities ?

     

    Thank you for your time in advance!

     



  • 7.  RE: BGP communities - AND or OR operations

    Posted 02-06-2019 19:33

    No, It can be any order.