Routing

 View Only
last person joined: 3 days ago 

Ask questions and share experiences about ACX Series, CTP Series, MX Series, PTX Series, SSR Series, JRR Series, and all things routing, including portfolios and protocols.
  • 1.  how to delete regular communities

    Posted 02-01-2018 00:53

    How to delete regular (common) communties and leave extended in the routes?

    I need to set regular community. Set means that all other regular communities should be deleted. But extended should be untouched.

    The received route is (with regular 100:5 and extended target:31133:5):

     

    * 100:5:55.0.0.1/32 (1 entry, 1 announced)
         Communities: 100:5 target:31133:5

    If use configuration like this:

     

     

        policy-statement delete_comm {
            term 20 {
                from protocol bgp;
                then {
                    community delete all-standard;
                    community add 200:5;    
                    accept;
                }
            }
        }
        community standart-all members *:*

    it will delete all communities regular and extended (target) and add regular 200:5:

     

    100:5:55.0.0.1/32 (1 entry, 1 announced)
         Communities: 200:5

     

     

    Workaround configuration:

     

    community all-standard {
        invert-match;
        members target:*:*;
    }   

    is working:

     

    100:5:55.0.0.1/32 (1 entry, 1 announced)
         Communities: 200:5 target:31133:5

    It deletes all communitites that don't match any extended target. But it's not good as it deletes all other extended communities (origin ro bandwidth) that could be attached to other routes. And even those (in future) that isn't developed yet.

    Is there some way to explicitly delete only regular communities?

     



  • 2.  RE: how to delete regular communities

    Posted 02-01-2018 19:13

    Hi!

     

    There is no direct way to remove only standard community. The correct way of achieving is what you are already trying, using regex match condition. You need to sort more details what all communities are being received in your environment and come up with a match condition that solves your purpose.

     

    How about below community for invert-match?

     

    show policy-options community test
    invert-match;
    members *:*:*;

     

    Below link displays some examples and regex operators that could be useful to you..

     

    https://www.juniper.net/documentation/en_US/junos/topics/usage-guidelines/policy-defining-bgp-communities-and-extended-communities-for-use-in-routing-policy-match-conditions.html

     



  • 3.  RE: how to delete regular communities

    Posted 02-05-2018 01:13

    Interesting attempt, but not acceptable by Junos:

    [edit policy-options community all-standard members]
      '*:*:*'
        Unknown extended community type
    error: configuration check-out failed


  • 4.  RE: how to delete regular communities

    Posted 02-05-2018 20:23
    Humm okay, didn't had the device handy for a quick test.


    Regards,
    Amit


  • 5.  RE: how to delete regular communities
    Best Answer

    Posted 02-01-2018 22:51

    Hello,

    This is pretty easy if You remember how JUNOS evaluates communities (hint-they are treated as strings):

     

    Community regular expressions evaluate the string specified in term on a
    character-by-character basis

    https://www.juniper.net/documentation/en_US/junos/topics/usage-guidelines/policy-defining-bgp-communities-and-extended-communities-for-use-in-routing-policy-match-conditions.html

     

    So, if You recall that regular communities are essentially "1-to-5 decimal digits {colon} 1-to-5 decimal digits " strings, then You need to define Your regular community as

     

    set policy-options community std members "^[0-9]{1,5}:[0-9]{1,5}"

    Lab verification:

    regress@VMX> show configuration routing-instances 
    TEST {
        instance-type vrf;
        route-distinguisher 169.254.3.242:3;
        vrf-import remove-std;
        vrf-export vrf-export;
        vrf-table-label;
    }
    
    regress@VMX> show configuration policy-options policy-statement remove-std 
    term 1 {
        from community [ std test ];
        then {
            community delete std;
            next term;
        }
    }
    term 2 {
        from community test;
        then accept;
    }
    
    regress@VMX> show configuration policy-options | grep members            
    community std members "^[0-9]{1,5}:[0-9]{1,5}";
    community test members target:65000:3;

    And the route in question is 198.51.100.3/32.

    regress@VMX> show route receive-protocol bgp 169.254.0.252 table bgp.l3vpn.0 extensive 198.51.100.3/32
    
    bgp.l3vpn.0: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
    * 169.254.3.231:3:198.51.100.3/32 (1 entry, 0 announced)
         Import Accepted
         Route Distinguisher: 169.254.3.231:3
         VPN Label: 16
         Nexthop: 169.254.3.231
         Localpref: 100
         AS path: I (Originator)
         Cluster list:  169.254.0.252
         Originator ID: 169.254.3.231
         Communities: 65000:65000 target:65000:3 bandwidth:65000:200
    
    regress@VMX> show route table TEST.inet.0 198.51.100.3/32 detail | grep commun                       
                    Communities: target:65000:3 bandwidth:65000:200
    ^
    |
    +--- regular community 65000:65000 missing!

    HTH

    Thx
    Alex

     

     



  • 6.  RE: how to delete regular communities

     
    Posted 03-27-2018 19:49

    Just my 2 cents on this…

     

    If you want to blindly chop the standard community from any ingress learnt prefixes; the below config will do the job, it removes from all learnt bgp prefixes [assuming you are applying it as a ingress policy]

     

    regress@VMX> show configuration policy-options policy-statement remove-std

    term 1 {

        then {

            community delete std;

        }

    }

     

    regress@VMX> show configuration policy-options | grep members           

    community std members "^[0-9]{1,5}:[0-9]{1,5}";