查看完整版本: JunOS 快速查看某部分路由的方法--1

水瓶女孩 2007-12-9 20:24

JunOS 快速查看某部分路由的方法--1

路由数量小的时候直接show route
让我们消耗的时间或许并不多,但对于Juniper的M/T系列来说,本身面向的就是Internet骨干路由器,很多情况下都会收全球路由,甚至本AS内所有的明细路由,这些量都是很大的,少则数万,多则数百万.在这时候我们还show
route来慢慢找的话是相当浪费时间的,或许有些人会说match,其实这是最笨的方法,和show route
慢慢按空格差不多,只不过不用你的眼睛去盯着.下面简单介绍一下我自己的一些体会:

1.根据路由所在的路由表来查找show route logical-router 163 table inet.0 terse

root@j72r42> show route logical-router
163 table inet.0 terse
inet.0: 3349 destinations, 10672 routes (3348 active, 0 holddown, 3
hidden)
+ = Active Route, - = Last Active, * = Both
A Destination        P Prf   
Metric 1   Metric 2  Next
hop        AS path
*
0.0.0.0/0          S   
5                        
Discard
* 1.0.0.0/16         B
170         
100            
>1.0.1.1         1
I
                     
B 170         
100          0
>1.0.1.1         1
I
                     
B 170         
100          0
>1.0.1.1         1
I
                     
B 170         
100          0
>163.0.2.2       4809 1
I
                     
B 170         
100          0
>163.0.1.2       65000 1 I

看起来这和直接show route
并没有什么区别,但如果你要看的ipv6路由或者组播路由,那你可能要把之前的几十万空格完了才能看到,由于在JunOS中,ipv4/ipv6/mpls路由都是分在不同的路由表中,这样使用table
routing-table-name 的方式来查看ipv4以外的路由是相当方便的.


2.根据路由协议来查找show route logical-router 163 protocol bgp
terse   

root@j72r42> show route logical-router
163 protocol bgp terse   
inet.0: 3349 destinations, 10672 routes (3348 active, 0 holddown, 3
hidden)
+ = Active Route, - = Last Active, * = Both
A Destination        P Prf   
Metric 1   Metric 2  Next
hop        AS path
*
1.0.0.0/16         B
170         
100            
>1.0.1.1         1
I
                     
B 170         
100          0
>1.0.1.1         1
I
                     
B 170         
100          0
>1.0.1.1         1
I
                     
B 170         
100          0
>163.0.2.2       4809 1
I
                     
B 170         
100          0
>163.0.1.2       65000 1 I

一般来说,一个规划得好的网络是不会存在太多不同的路由协议的,但就骨干网来说,通常至少会有两种:BGP和ISIS,BGP的路由数量显然是最多的,但由于ISIS主要承担接口地址的互通,网络规模大了以后ISIS路由的数量也不可小看.区分协议来查看很有必要.


3.根据收到该路由的协议及邻居来查看show route logical-router 163 receive-protocol bgp
163.0.0.11

root@j72r42> show route logical-router
163 receive-protocol bgp 163.0.0.11
inet.0: 3349 destinations, 10672 routes (3348 active, 0 holddown, 3
hidden)
   
Prefix                  
Nexthop               
MED     Lclpref    AS path
   
1.0.0.0/16               
1.0.1.5               
0      
100        1 I
   
1.0.1.0/30               
1.0.1.5               
0      
100        1 I
   
1.0.1.8/30               
1.0.1.5               
0      
100        1 I
   
1.0.1.12/30            
1.0.1.5               
0      
100        1 I

这里需要主意的是:这种方法对链路状态路由协议无效(原因?自己想),支持bgp,dvmrp,msdp,pim,rip,ripng等集中协议.


4.查看通告给相应邻居对应协议的路由show route logical-router 163 advertising-protocol bgp
163.0.0.11

root@j72r42> show route logical-router
163 advertising-protocol bgp 163.0.0.11   
inet.0: 3349 destinations, 10672 routes (3348 active, 0 holddown, 3
hidden)
   
Prefix                  
Nexthop               
MED     Lclpref    AS path
*
0.0.0.0/0               
Self                 
0      
100        8888 9999 9999 9999 9999 9999
I
*
1.0.0.0/16               
1.0.1.1               
0      
100        1 I
*
1.0.1.4/30               
1.0.1.1               
0      
100        1 I
*
1.0.1.8/30               
1.0.1.1               
0      
100        1 I

和3一样,这里也仅支持那集中协议.


5.根据BGP路由的AS-Path属性来查看show route logical-router 163 terse aspath-regex
.*9808

root@j72r42> show route logical-router
163 terse aspath-regex .*9808
inet.0: 3349 destinations, 10672 routes (3348 active, 0 holddown, 3
hidden)
+ = Active Route, - = Last Active, * = Both
A Destination        P Prf   
Metric 1   Metric 2  Next
hop        AS path
*
211.103.0.0/17     B
170         
100          0
>163.0.1.6       9808
I
                     
B 170         
100          0
>163.0.1.10      9808
I
                     
B 170         
100          0
>163.0.2.2       4809 9808
I
                     
B 170         
100          0
>163.0.1.2       65000 4809 9808 I
*
211.103.0.0/18     B
170         
100          0
>163.0.1.6       9808
I
                     
B 170         
100          0
>163.0.1.10      9808
I
                     
B 170         
100          0
>163.0.2.2       4809 9808
I
                     
B 170         
100          0
>163.0.1.2       65000 4809 9808 I

需要注意的是:当aspath-regex参数后跟的正则表达式中含有某些cli已用的或其他特殊字符时需要用""括起来,例如

root@j72r42> show route logical-router
163 terse aspath-regex "()"     
inet.0: 3349 destinations, 10672 routes (3348 active, 0 holddown, 3
hidden)
+ = Active Route, - = Last Active, * = Both
A Destination        P Prf   
Metric 1   Metric 2  Next
hop        AS path
*
0.0.0.0/0          S   
5                        
Discard
* 1.0.1.0/30         
D   
0                       
>fxp2.80     
*
1.0.1.2/32         L   
0                        
Local
* 58.30.0.0/15       I
165         
10            
>163.0.1.6
                     
B 170         
100          0
>163.0.1.6       I

6.根据community来查看show route logical-router 163 terse community
4134:1631

root@j72r42> show route logical-router
163 terse community 4134:1631
inet.0: 3349 destinations, 10672 routes (3348 active, 0 holddown, 3
hidden)
+ = Active Route, - = Last Active, * = Both
A Destination        P Prf   
Metric 1   Metric 2  Next
hop        AS path
   
58.30.0.0/15       B
170         
100          0
>163.0.1.6       I
   
58.32.0.0/13       B
170         
100          0
>163.0.1.6       I
   
58.40.0.0/15       B
170         
100          0
>163.0.1.6       I
   
58.42.0.0/17       B
170         
100          0
>163.0.1.6       I
   
58.42.128.0/17     B
170         
100          0
>163.0.1.6       I

可以更细化的根据这条路由的来源来查找(前提当然是这条路由是BGP且打了community)


7.与6相反,查看没有community的路由show route logical-router 163 terse
no-community

root@j72r42> show route logical-router
163 terse no-community         
inet.0: 3349 destinations, 10672 routes (3348 active, 0 holddown, 3
hidden)
+ = Active Route, - = Last Active, * = Both
A Destination        P Prf   
Metric 1   Metric 2  Next
hop        AS path
*
0.0.0.0/0          S   
5                        
Discard
* 1.0.1.0/30         
D   
0                       
>fxp2.80     
*
1.0.1.2/32         L   
0                        
Local
* 58.30.0.0/15       I
165         
10            
>163.0.1.6
* 58.32.0.0/13       I
165         
10            
>163.0.1.6
* 58.40.0.0/15       I
165         
10            
>163.0.1.6

fannao 2007-12-9 21:07

好的很,顶好的很,顶好的很,顶好的很,顶

flickxie 2007-12-10 00:27

不厚道啊。。。咋不注明转帖呢????

admin 2008-1-4 08:36

下回我们会注明是从那转的!!

可乐小子 2008-1-5 17:29

这个教程是不错的哦,谢谢了啊!偶收藏了。
页: [1]
查看完整版本: JunOS 快速查看某部分路由的方法--1