华为路由器静态路由配置命令
4.6.1 ip route
配置或删除静态路由。 [ no ] ip route ip-address
{ mask | mask-length } { interfacce-name
| gateway-address } [ preference preference-value ] [ reject | blackhole ] 【参数说明】
ip-address和mask为目的IP地址和掩码,点分十进制格式,由于要求掩码32位中‘1’必须是连续的,因此点分十进制格式的掩码可以用掩码长度mask-length来代替,掩码长度为掩码中连续‘1’的位数。 interfacce-name指定该路由的发送接口名,gateway-address为该路由的下一跳IP地址(点分十进制格式)。
preference-value为该路由的优先级别,范围0~255。 reject指明为不可达路由。 blackhole指明为黑洞路由。 【缺省情况】
系统缺省可以获取到去往与路由器相连子网的子网路由。在配置静态路由时如果不指定优先级,则缺省为60。如果没有指明reject或blackhole,则缺省为可达路由。 【命令模式】 全局配置模式 【使用指南】
配置静态路由的注意事项:
当目的IP地址和掩码均为0.0.0.0时,配置的缺省路由,即当查找路由表失败后,根据缺省路由进行包的转发。
对优先级的不同配置,可以灵活应用路由管理策略,如配置到达相同目的地的多条路由,如果指定相同优先级,则可实现负载分担;如果指定不同优先级,则可实现路由备份。
在配置静态路由时,既可指定发送接口,也可指定下一跳地址,到底采用哪种方法,需要根据实际情况而定:对于支持网络地址到链路层地址解析的接口或点到点接口,指定发送接口即可;对于NBMA接口,如封装X.25或帧中继的接口、拨号口等,支持点到多点,这时除了配置IP路由外,还需在链路层建立二次路
由,即IP地址到链路层地址的映射(如dialer
map ip、x.25 map ip或frame-relay map ip等),这种情? 配置静态路由不能指定发送接口,应配置下一跳IP地址。 【举例】
配置缺省路由的下一跳为129.102.0.2。
Quidway(config)#ip route 0.0.0.0 0.0.0.0 129.102.0.2 【相关命令】
show ip route,show ip route detail,show ip route static 4.6.2 show ip route
显示路由表摘要信息。 show ip route 【命令模式】 特权用户模式 【使用指南】
该命令输出以列表方式显示路由表,每一行代表一条路由,内容包括: 目的地址/掩码长度 协议 优先级 度量值 下一跳 输出接口 【举例】
Quidway#show ip route Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface 127.0.0.0/8 Static 0 0 127.0.0.1 127.0.0.1(LO0)
127.0.0.1/32 Direct 0 0 127.0.0.1 127.0.0.1(LO0)
138.102.128.0/17 Direct 0 0 138.102.129.7 138.102.129.7(EN0) 202.38.165.0/24 Direct 0 0 202.38.165.1 202.38.165.1(SL1) 【相关命令】
ip route,show ip route detail,show ip route static 4.6.3 show ip route detail 显示路由表详细信息 show ip route detail 【命令模式】 特权用户模式 【使用指南】
该命令输出信息帮助用户进行路由方面的故障诊断。 【举例】
Quidway#show ip route detail Route state description
NoAdv: do not advertiset Int: AS Interior route Ext: AS External route Del: route to be deleted
Active: current route Retain: route retains in the routing table
Rej: rejecting route Black: black hole route Routing Tables: Generate Default: no
+ = Active Route, - = Last Active, * = Both
Destinations: 4 Routes: 4 Holddown: 0 Delete: 9 Hidden: 0
**Destination: 127.0.0.0 Mask: 255.0.0.0 Protocol: *Static Preference: 0
NextHop: 127.0.0.1 Interface: 127.0.0.1(LO0) State: $#@60;NoAdv Int Active Retain Rej$#@62; Age: 19:31:06 Metric: 0/0
**Destination: 127.0.0.1 Mask: 255.255.255.255 Protocol: *Direct Preference: 0
NextHop: 127.0.0.1 Interface: 127.0.0.1(LO0) State: $#@60;NoAdv Int Active Retain$#@62; Age: 114:03:05 Metric: 0/0
Holddown路由指的是:一些distance vector 路由协议(如RIP),为了避免错误路由的扩散,提高路由不可达信息的快速准确传播,而采用的一种路由发布策略。它往往在一段时间间隔内固定地发布某条路由,而不管当前实际找回的到同一目的的路由发生了什么变化。其细节参见具体的路由协议。
在路由表统计中显示的是当前被Holddown的路由数目。有些路由由于某种原因(如接口Down)暂时不可用,但是又不希望被删除,我们把这种路由隐藏起来。以便以后能重新恢复在路由表统计中显示的是当前被隐藏的路由数目。
【相关命令】
ip route,show ip route,show ip route static 4.6.4 show ip route static
显示静态路由表。 show ip route static 【命令模式】 特权用户模式 【使用指南】
根据该命令输出信息,可以帮助用户确认对静态路由的配置是否正确。 【举例】
Quidway#show ip route static
Static routes for family INET: (* indicates gateway(s) in use)
1.2.3.0/24 pref 60 $#@60;Int$#@62; intf EN0
127.0.0.0/8 pref 0 $#@60;NoAdv Int Retain Rej$#@62; intf 127.0.0.1
以列表的方式显示静态路由表,每一行代表一条静态路由,从左到右依次为:
目的地址/掩码长度 优先级
$#@60;状态参数$#@62; 输出接口和下一跳 【相关命令】
ip route,show ip route,show ip route detail 路由器IP性能配置命令 4.5.1 clear ip counters 清除IP统计信息。 clear ip counters 【命令模式】 特权用户模式 【使用指南】
在某些特殊情况下,需要清除IP统计信息,重新进行统计。 【举例】
清除IP统计信息。
华为路由器静态路由配置命令



