[j-nsp] Matching communities in 'show route receive-protocol bgp' command
Stacy W. Smith
stacy at acm.org
Wed Jul 6 12:28:07 EDT 2011
OK. Thanks for the additional details. That allows me to replicate the behavior you are seeing.
It seems the 'community' argument to 'show route' always evaluates post import policy even when 'receive-protocol' is specified.
Here's an example.
Route is received with community 1:1.
root at j6300> show route receive-protocol bgp 192.168.0.1 detail
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
__juniper_private1__.inet.0: 4 destinations, 4 routes (2 active, 0 holddown, 2 hidden)
R1.inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
* 192.168.200.0/25 (1 entry, 1 announced)
Accepted
Nexthop: 192.168.0.1
AS path: 1 I
Communities: 1:1
My import policy uses 'community set' to replace the community with 2:2.
root at j6300> show route protocol bgp detail
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
__juniper_private1__.inet.0: 4 destinations, 4 routes (2 active, 0 holddown, 2 hidden)
R1.inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
192.168.200.0/25 (1 entry, 1 announced)
*BGP Preference: 170/-101
Next hop type: Router, Next hop index: 568
Next-hop reference count: 2
Source: 192.168.0.1
Next hop: 192.168.0.1 via lt-0/0/0.1, selected
State: <Active Ext>
Local AS: 2 Peer AS: 1
Age: 2:24
Task: BGP_1_2.192.168.0.1+179
Announcement bits (1): 0-KRT
AS path: 1 I
Communities: 2:2
Accepted
Localpref: 100
Router ID: 192.168.255.254
Now I can no longer match on 1:1.
root at j6300> show route receive-protocol bgp 192.168.0.1 community 1:1
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
__juniper_private1__.inet.0: 4 destinations, 4 routes (2 active, 0 holddown, 2 hidden)
R1.inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
But I can match on 2:2, even when 'receive-protocol' is specified.
root at j6300> show route receive-protocol bgp 192.168.0.1 community 2:2
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
__juniper_private1__.inet.0: 4 destinations, 4 routes (2 active, 0 holddown, 2 hidden)
R1.inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
Prefix Nexthop MED Lclpref AS path
* 192.168.200.0/25 192.168.0.1 1 I
I suspect this is because each argument to 'show route' is evaluated independently. I'm not aware of a way to change this behavior.
Would it be acceptable to change your import policies to use 'community add' rather than 'community set'? That would be a potential workaround.
--Stacy
On Jul 6, 2011, at 10:04 AM, Alexander Shikoff wrote:
> On Wed, Jul 06, 2011 at 09:50:55AM -0600, Stacy W. Smith wrote:
>> I just tried to replicate your problem (on an old version of JunOS), and the community knob works as expected for me.
>>
>> root at j6300> show version
>> Hostname: j6300
>> Model: j6300
>> JUNOS Software Release [9.3S9]
>>
>> root at j6300> show route receive-protocol bgp 192.168.0.1 detail table R1.inet.0
>>
>> R1.inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
>> * 192.168.200.0/25 (1 entry, 1 announced)
>> Accepted
>> Nexthop: 192.168.0.1
>> AS path: 1 I
>> Communities: 1:1
>>
>> root at j6300> show route receive-protocol bgp 192.168.0.1 community 1:1
>>
>> inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
>>
>> __juniper_private1__.inet.0: 4 destinations, 4 routes (2 active, 0 holddown, 2 hidden)
>>
>> R1.inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
>> Prefix Nexthop MED Lclpref AS path
>> * 192.168.200.0/25 192.168.0.1 1 I
>>
>>
>> What version of JunOS are you using? What platform?
> JunOS 10.3R3.7
> Juniper MX80-48T
>
>> Can you also provide us with the output 'show route ams-ix.net extensive table World.inet.0'?
> minotaur at br1-gdr.ki> show route ams-ix.net extensive table World.inet.0
>
> World.inet.0: 362220 destinations, 720282 routes (358772 active, 30 holddown, 3907 hidden)
> 91.200.16.0/22 (2 entries, 1 announced)
> TSI:
> KRT in-kernel 91.200.16.0/22 -> {77.88.200.133}
> Destination class: to-World
> Source class: from-World
> *BGP Preference: 170/-111
> Next hop type: Router, Next hop index: 711
> Next-hop reference count: 760367
> Source: 77.88.200.133
> Next hop: 77.88.200.133 via ge-1/0/1.1252, selected
> State: <Active Ext>
> Peer AS: 21011
> Age: 1w3d 5:47:14
> Task: BGP_21011.77.88.200.133+56251
> Announcement bits (4): 0-RT 1-KRT 2-rt-export 4-Resolve tree 2
> AS path: 21011 1200 I
> AS path: Recorded
> Communities: 25372:20480
> Accepted
> Localpref: 110
> Router ID: 88.81.250.22
> BGP Preference: 170/-101
> Next hop type: Router, Next hop index: 767
> Next-hop reference count: 1743395
> Source: 87.245.247.13
> Next hop: 87.245.247.13 via ge-1/0/0.200, selected
> State: <Ext>
> Inactive reason: Local Preference
> Peer AS: 9002
> Age: 38:51
> Task: BGP_9002.87.245.247.13+179
> AS path: 9002 1200 I
> Communities: 25372:6 25372:20480
> Accepted
> Localpref: 100
> Router ID: 87.245.225.101
>
> I'm changing communities when importing routes. If call the command with
> 'receive-protocol bgp' then the output will differ:
> minotaur at br1-gdr.ki> show route ams-ix.net receive-protocol bgp 77.88.200.133 extensive table World.inet.0
>
> World.inet.0: 362199 destinations, 720243 routes (358775 active, 6 holddown, 3906 hidden)
> * 91.200.16.0/22 (2 entries, 1 announced)
> Accepted
> Nexthop: 77.88.200.133
> AS path: 21011 1200 I
> AS path: Recorded
> Communities: 21011:400 21011:6777 21011:64528 31445:400
>
>
> Now let's try to filter routes by community:
>
> minotaur at br1-gdr.ki> show route ams-ix.net community 25372:20480 table World
>
> World.inet.0: 362185 destinations, 720235 routes (358767 active, 0 holddown, 3906 hidden)
> + = Active Route, - = Last Active, * = Both
>
> 91.200.16.0/22 *[BGP/170] 1w3d 05:50:14, localpref 110
> AS path: 21011 1200 I
>> to 77.88.200.133 via ge-1/0/1.1252
> [BGP/170] 00:41:51, localpref 100
> AS path: 9002 1200 I
>> to 87.245.247.13 via ge-1/0/0.200
>
> It works.
>
> Now let's try to filter routes but with 'receive protocol bgp' options:
> minotaur at br1-gdr.ki> show route ams-ix.net receive-protocol bgp 77.88.200.133 extensive table World.inet.0 community 21011:64528
>
> - empty output.
>
> For some strange reason filtering by community does not work for me with 'receive protocol bgp'
> option.
>
> --
> MINO-RIPE
More information about the juniper-nsp
mailing list