Mailing List Archive

Routes matching two or more communities
Hi,

I am trying to count all routes that match 2 of my communities. A command
of the type: sh route community "AS:nnn AS:zzz" does not result in any
routes even though I found such routes.

I would appreciate any suggestions,
Hazim
Routes matching two or more communities [ In reply to ]
Well, for a logical or you can try this:

[edit policy-options]
lab@r3# run show route 3/8 detail

inet.0: 105888 destinations, 105889 routes (105888 active, 0
holddown, 0 hidden)
3.0.0.0/8 (1 entry, 1 announced)
*BGP Preference: 170/-101
Source: 172.16.0.14
Next hop: 172.16.0.14 via fe-0/0/2.0, selected
State: <Active Ext>
Local AS: 65412 Peer AS: 65222
Age: 5:01
Task: BGP_65222.172.16.0.14+4938
Announcement bits (3): 0-KRT 2-BGP.0.0.0.0+179
4-Resolve inet.0
AS path: 65222 10458 14203 2914 7018 80 I
Communities: 2914:420 65412:69 65412:420<<<<< route
has three comms
Localpref: 100
Router ID: 130.130.0.1

[edit policy-options]
lab@r3# run show route community "(65412:69|65412:420)"

inet.0: 105888 destinations, 105889 routes (105888 active, 0
holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

3.0.0.0/8 *[BGP/170] 00:05:11, localpref 100
AS path: 65222 10458 14203 2914 7018 80 I
> to 172.16.0.14 via fe-0/0/2.0
4.0.0.0/8 *[BGP/170] 00:05:11, localpref 100
AS path: 65222 10458 14203 2914 3356 I
> to 172.16.0.14 via fe-0/0/2.0
.
.
.

Unfortunately I know of no logical and function (&& does not work).
If you need to count routes that have both, you might try some
cascaded piping:


edit policy-options]
lab@r3# run show route detail community 65412:69 | match 65412:420 |
count
Count: 105863 lines


<< Note that I have a full BGP feed and the policy below is setting
the two comms on all routes:

[edit policy-options]
lab@r3# show policy-statement ebgp-in
term 1 {
from {
protocol bgp;
neighbor 172.16.0.14;
}
then {
community add transit;
community add test;
}
}

[edit policy-options]
lab@r3# show community transit
members 65412:420;

[edit policy-options]
lab@r3# show community test
members 65412:69;

The count pretty much matches the number of active routes:

[edit policy-options]
lab@r3# run show bgp summary
Groups: 4 Peers: 7 Down peers: 2
Table Tot Paths Act Paths Suppressed History Damp State
Pending
inet.0 105862 105861 0 0 0
0
inet6.0 1 1 0 0 0
0
Peer AS InPkt OutPkt OutQ Flaps Last
Up/Dwn State|#Active/Received/Damped...
172.16.0.14 65222 20863 59186 0 4
41:00 Establ
inet.0: 105858/105858/0
inet6.0: 1/1/0

So I think it will work for U!

HTHs.



> -----Original Message-----
> From: juniper-nsp-bounces@puck.nether.net
> [mailto:juniper-nsp-bounces@puck.nether.net]On Behalf Of
> Hazim Oumera
> Sent: Tuesday, May 13, 2003 1:26 PM
> To: juniper-nsp@puck.nether.net
> Subject: [j-nsp] Routes matching two or more communities
>
>
> Hi,
>
> I am trying to count all routes that match 2 of my
> communities. A command
> of the type: sh route community "AS:nnn AS:zzz" does not
> result in any
> routes even though I found such routes.
>
> I would appreciate any suggestions,
> Hazim
> _______________________________________________
> juniper-nsp mailing list juniper-nsp@puck.nether.net
> http://puck.nether.net/mailman/listinfo/juniper-nsp
Routes matching two or more communities [ In reply to ]
On Tue, May 13, 2003 at 04:26:04PM -0400, Hazim Oumera wrote:
> I am trying to count all routes that match 2 of my communities.

...which match BOTH or EITHER ONE of the two?

> A command of the type: sh route community "AS:nnn AS:zzz" does
> not result in any routes even though I found such routes.

Try:

show route community [ AS:nnn AS:zzz ]

This shows all routes matching both communities.


Regards,
Daniel
Routes matching two or more communities [ In reply to ]
Thanks for the suggestions. The following command almost helped me count
the routes I needed:

show route community [5511:500 "5511:5[0-2][1-8]" "no-export"] | count

Using double quotes was necessary when using ranges. I am still tuning the
expression as the original objective was to match the above with "NOT
no-export" instead of "no-export".

Regards,
Hazim

On Tue, 13 May 2003, Daniel Roesen wrote:

> On Tue, May 13, 2003 at 04:26:04PM -0400, Hazim Oumera wrote:
> > I am trying to count all routes that match 2 of my communities.
>
> ...which match BOTH or EITHER ONE of the two?
>
> > A command of the type: sh route community "AS:nnn AS:zzz" does
> > not result in any routes even though I found such routes.
>
> Try:
>
> show route community [ AS:nnn AS:zzz ]
>
> This shows all routes matching both communities.
>
>
> Regards,
> Daniel
> _______________________________________________
> juniper-nsp mailing list juniper-nsp@puck.nether.net
> http://puck.nether.net/mailman/listinfo/juniper-nsp
>
Routes matching two or more communities [ In reply to ]
On Tue, May 13, 2003 at 05:58:51PM -0400, Hazim Oumera wrote:
> Thanks for the suggestions. The following command almost helped me count
> the routes I needed:
>
> show route community [5511:500 "5511:5[0-2][1-8]" "no-export"] | count

This won't give you the count of routes... you will have to filter
the output first, e.g.

show ... | match \* | match localpref | count


Regards,
Daniel