display ip routing-table [ verbose ]
display ip routing-table ip-address [ mask | mask-length ] [ longer-match ] [ verbose ]
display ip routing-table ip-address { mask | mask-length } nexthop ip-address [ verbose ]
display ip routing-table ip-address1 { mask1 | mask-length1 } ip-address2 { mask2 | mask-length2 } [ verbose ]
display ip routing-table acl acl-number [ verbose ]
display ip routing-table ip-prefix ip-prefix-name [ verbose ]
| 参数 | 参数说明 | 取值 |
|---|---|---|
| verbose | 显示激活和未激活路由的详细信息。不指定该参数,则只显示激活路由的概要信息。 | - |
| ip-address | 目的IP地址。 | 点分十进制格式。 |
| longer-match | 仅显示与特定网络/掩码匹配的路由。 | - |
| nexthop ip-address | 下一跳的IP地址。 | 点分十进制格式。 |
| mask | 掩码。 | 点分十进制格式。 |
| mask-length | 掩码长度。 | 整数形式,取值范围是0~32。 |
| ip-address1 / ip-address2 | 目的IP地址。ip-address1和ip-address2共同决定一个地址范围,从而显示在此范围内的路由信息。 | ip-address1和ip-address2都是点分十进制格式。 |
| mask1 | mask-length1 | 目的地址ip-address1的掩码/掩码长度。 | - |
| mask2 | mask-length2 | 目的地址ip-address2的掩码/掩码长度。 | - |
| acl | 使用ACL对输出的信息进行过滤。如果指定的ACL不存在,将显示所有激活路由的信息。 | - |
| acl-number | 基本访问控制列表ACL(Access Control List)号。 | 整数形式,取值范围是2000~2999。 |
| ip-prefix ip-prefix-name | 指定前缀列表名称。 | 字符串形式,取值范围是1~169,不支持空格,区分大小写。当输入的字符串两端使用双引号时,可在字符串中输入空格。 |
应用场景
对于未加verbose参数的显示信息中,每一行代表一条路由。内容包括目的地址、掩码长度、协议、优先级、路由开销值、路由标记、下一跳和输出接口。
迭代路由不论迭代出多少出接口和下一跳,仅统计为一条路由。
该命令(不含verbose参数)只显示当前被优选的路由。
对于此命令,根据显示需要的不同,可以通过选择参数来进行不同的方式的匹配。
对于display ip routing-table ip-address,显示与目的地址最长匹配的路由表项。
对于display ip routing-table ip-address mask,显示与目的地址和掩码精确匹配的路由表项。
对于display ip routing-table ip-address longer-match,显示与目的地址和自然掩码指定的IP地址匹配的所有路由表项。
对于display ip routing-table ip-address mask longer-match,显示与目的地址和输入掩码指定的IP地址匹配的所有路由表项。
对于display ip routing-table ip-address1 mask1 ip-address2 mask2,该命令用来查看目的地址在输入的ip-address1 mask1到ip-address2 mask2范围内的路由表项。
注意事项
如果指定的ip-prefix ip-prefix-name不存在,该命令显示当前所有被优选的路由。
# 显示当前路由表的概要信息,路由1.1.1.1/32为两条静态路由(下一跳不同),所以路由计数为8。
<sysname> display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 7 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Static 60 0 D 0.0.0.0 NULL0
Static 60 0 D 100.0.0.1 GigabitEthernet1/0/0
100.0.0.0/24 Direct 0 0 D 100.0.0.1 GigabitEthernet1/0/0
100.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/0
103.0.0.0/24 Direct 0 0 D 103.0.0.1 GigabitEthernet1/0/1
103.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
项目 |
描述 |
|---|---|
Route Flags |
路由标记:
|
Routing Tables:Public |
此路由表是公网路由表。 |
Destinations |
目的网络/主机的总数。 |
Routes |
路由的总数。 |
Destination/Mask |
目的网络/主机的地址和掩码长度。 |
Proto |
用来学习路由的协议。 |
Pre |
优先级。 |
Cost |
路由开销。 |
Flags |
路由标记,即路由表头的Route Flags。 |
NextHop |
下一跳。 |
Interface |
下一跳可达的出接口。 |
# 显示当前路由表的概要信息,路由2.2.2.2/32为一条静态路由(下一跳1.1.1.1相同),该路由为迭代路由,由于1.1.1.1有两个出接口,故2.2.2.2/32也迭代出了这两个出接口,但是目的网络仍然为一个,所以路由计数为9。
<sysname> display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 8 Routes : 9
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Static 60 0 D 0.0.0.0 NULL0
Static 60 0 D 100.0.0.1 GigabitEthernet1/0/0
2.2.2.2/32 Static 60 0 RD 1.1.1.1 NULL0
Static 60 0 RD 1.1.1.1 GigabitEthernet1/0/0
100.0.0.0/24 Direct 0 0 D 100.0.0.1 GigabitEthernet1/0/0
100.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/0
103.0.0.0/24 Direct 0 0 D 103.0.0.1 GigabitEthernet1/0/1
103.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet1/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
# 显示路由表的详细信息。
<sysname> display ip routing-table verbose
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Destinations : 3 Routes : 3
Destination: 30.0.0.36/32
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 127.0.0.1 Neighbour: 0.0.0.0
State: Active Adv Age: 01h03m56s
Tag: 0 Priority: high
Label: NULL QoSInfo: 0x0
IndirectID: 0x0
RelayNextHop: 0.0.0.0 Interface: GigabitEthernet1/0/1
TunnelID: 0x0 Flags: D
Destination: 60.0.0.36/32
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 127.0.0.1 Neighbour: 0.0.0.0
State: Active Adv Age: 00h26m41s
Tag: 0 Priority: high
Label: NULL QoSInfo: 0x0
IndirectID: 0x0
RelayNextHop: 0.0.0.0 Interface: GigabitEthernet1/0/2
TunnelID: 0x0 Flags: D
Destination: 60.35.36.0/24
Protocol: Direct Process ID: 0
Preference: 0 Cost: 0
NextHop: 60.35.36.2 Neighbour: 0.0.0.0
State: Active Adv Age: 00h26m36s
Tag: 0 Priority: high
Label: NULL QoSInfo: 0x0
IndirectID: 0x0
RelayNextHop: 0.0.0.0 Interface: GigabitEthernet1/0/0
TunnelID: 0x0 Flags: D
项目 |
描述 |
|---|---|
Route Flags |
路由标记:
|
Destinations |
目的网络/主机的总数。 |
Routes |
激活路由和非激活路由的总数。 |
Destination |
目的网络/主机的地址和掩码长度。 |
Protocol |
路由协议。 |
Process ID |
路由协议的进程号。 |
Preference |
路由的优先级。 |
Cost |
路由开销。 |
NextHop |
下一跳。 |
Neighbour |
邻居。 |
State |
路由的状态
|
Age |
路由的存活时间。 |
Tag |
路由管理标识。整数形式,取值范围是0~4294967295。 |
Priority |
路由的收敛优先级。
|
Label |
MPLS分配的标签。 |
QoSInfo |
QoS信息,其中0x0表示QoS信息为空。32位八进制数,其中从右到左最低三位八进制数代表QoS local ID的值,可以通过apply qos-local-id命令配置;第四位和第七位预留,取值都是0;第五位和第六代表BGP traffic index的值,可以通过apply traffic-index命令配置;第八位是标志位。 |
IndirectID |
下一跳分离关键字,由系统自动生成,用户无法配置。如果路由是非迭代路由,该值显示为0x0;如果路由是迭代路由,该值不为0x0。 |
RelayNextHop |
迭代下一跳。 |
Interface |
迭代出接口。 |
Tunnel ID |
隧道ID。 |
Flags |
路由标记,即路由表头的Route Flags。 |
# 显示通过ACL2000过滤的激活路由的概要信息。
<sysname> display ip routing-table acl 2000
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routes Matched by Access list 2000:
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
172.16.0.0/16 Static 60 0 D 0.0.0.0 NULL0
# 显示自然掩码范围内与目的IP地址169.0.0.0匹配的路由信息。
<sysname> display ip routing-table 169.0.0.0 Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Summary Count: 1 Destination/Mask Proto Pre Cost Flags Nexthop Interface 169.0.0.0/16 Static 60 0 D 2.1.1.1 LoopBack1
# 根据下一跳显示目的地址为1.1.1.1/32的路由。
<sysname> display ip routing-table 1.1.1.1 32 nexthop 2.2.2.2
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 Static 60 0 RD 2.2.2.2 NULL0
# 显示目的地址在1.0.0.0/8到4.0.0.0/24范围内的路由信息。
<sysname> display ip routing-table 1.0.0.0 8 4.0.0.0 24
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.0.0.0/8 Static 60 0 D 10.0.0.1 GigabitEthernet1/0/2
1.1.1.0/24 Static 60 0 D 2.1.1.1 GigabitEthernet1/0/2
1.2.0.0/16 Static 60 0 D 10.0.0.1 GigabitEthernet1/0/2
2.1.1.0/24 Static 40 0 D 10.0.0.1 GigabitEthernet1/0/2
3.1.1.0/24 Static 60 0 D 4.1.1.1 GigabitEthernet1/0/2
# 显示通过前缀列表abc2过滤的激活路由的概要信息。
<sysname> display ip routing-table ip-prefix abc2
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routes Matched by Prefix-list abc2:
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags Nexthop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
169.0.0.0/8 Static 60 0 D 2.1.1.1 LoopBack1
169.0.0.0/15 Static 60 0 D 2.1.1.1 LoopBack1