15-自动侦测命令
本章节下载 (138.62 KB)
【命令】
detect-group group-number
undo detect-group group-number
【视图】
系统视图
【参数】
group-number:自动侦测组的编号,取值范围为1~50。
【描述】
detect-group命令用来创建一个自动侦测组,并进入侦测组视图。undo detect-group命令用来删除一个指定的自动侦测组。
【举例】
# 创建一个自动侦测组10。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] detect-group 10
[H3C-detect-group-10]
【命令】
detect-list list-number ip address ip-address [ nexthop ip-address ]
undo detect-list list-number
【视图】
侦测组视图
【参数】
list-number:侦测组中各个侦测地址的序号,取值范围为1~10。
Ip address ip-address:指定自动侦测的IP地址(点分十进制格式)。
nexthop ip-address:指定自动侦测从下一跳的某个IP地址开始。
【描述】
detect-list命令用来配置在某一个侦测组中,需要侦测的IP地址及侦测的先后顺序。undo detect-list命令用来取消配置的侦测对象和顺序。
配置好要侦测的IP地址后,交换机就按照list-number指定的序号,从小到大,依次对IP地址进行侦测。多个侦测地址之间的关系由option命令确定。
相关配置可参考option命令。
【举例】
# 在侦测组10中,增加侦测对象202.13.1.55,侦测序号为1。自动侦测从下一跳地址1.2.3.4开始。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] detect-group 10
[H3C-detect-group-10] detect-list 1 ip address 202.13.1.55 nexthop 1.2.3.4
【命令】
display detect-group [ group-number ]
【视图】
任意视图
【参数】
group-number:自动侦测组的编号,取值范围为1~50。
【描述】
display detect-group命令用来显示某个指定侦测组或所有侦测组的配置信息。
【举例】
# 显示侦测组1的配置信息。
<H3C> display detect-group 1
detect-group 1 :
detect loop time(s) : 15
ping wait time(s) : 2
detect retry times : 2
detect ip option : and
group state : not detecting
register module num : 0
detect ip count : 1
detect-list ip address next hop
1 202.13.1.55 1.2.3.4
表1-1 display detect-group命令显示信息描述表
字段 |
描述 |
detect-group 1 |
自动侦测组1 |
detect loop time(s): 15 |
自动侦测的循环周期为15秒 |
ping wait time(s): 2 |
一次侦测中的超时时间为2秒 |
detect retry times: 2 |
一次侦测中重试的次数为2次 |
detect ip option: and |
侦测组中各个侦测对象间的逻辑关系为“与” |
group state: not detecting |
自动侦测组目前的状态:没有进行侦测 |
register module num |
注册模块数(即侦测组被引用的次数) |
detect ip count |
自动侦测的IP地址数目 |
detect-list |
侦测对象的序号 |
ip address |
需要侦测的IP地址 |
next hop |
下一跳的IP地址 |
【命令】
option [ and | or ]
undo option
【视图】
侦测组视图
【参数】
and:侦测对象之间的关系为“逻辑与”。
or:侦测对象之间的关系为“逻辑或”。
【描述】
option命令用来设置一个侦测组中各个侦测对象间的逻辑关系。undo option命令用来将一个侦测组中各个侦测对象间的逻辑关系恢复为缺省值。
缺省情况下,各个侦测对象之间的逻辑关系为and。
进行每轮侦测时,交换机按照侦测对象对应的序号(list-number),从小到大依次侦测各个IP地址的可达性:
l 当侦测对象之间的关系为and时:有一个IP地址无法ping通即认为该侦测组不可达,并不再侦测其余的地址;
l 当侦测对象之间的关系为or时:有一个IP地址ping通即认为该侦测组可达,并不再侦测其余的地址。
【举例】
# 设置侦测组10中的侦测对象之间的关系为逻辑或。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] detect-group 10
[H3C-detect-group-10] option or
【命令】
retry retry-times
undo retry
【视图】
侦测组视图
【参数】
retry-times:一次侦测中重试的次数,取值范围为0~10,缺省值是2。
【描述】
retry命令用来设置侦测组在一次侦测中的最大重试次数。undo retry命令用来将侦测组在一次侦测中的最大重试次数恢复为缺省值。
【举例】
# 配置侦测组10中,一轮侦测中最大的重试次数为3。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] detect-group 10
[H3C-detect-group-10] retry 3
【命令】
timer loop seconds
undo timer loop
【视图】
侦测组视图
【参数】
seconds:自动侦测的循环周期,取值范围为1~86400,单位为秒,缺省值是15。
【描述】
timer loop命令用来设置自动侦测的循环周期,即每隔一定的时间对所有侦测对象进行一次侦测。undo timer loop命令用来将自动侦测的循环周期恢复为缺省值。
【举例】
# 配置侦测组10的侦测循环周期为60秒。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] detect-group 10
[H3C-detect-group-10] timer loop 60
【命令】
timer wait seconds
undo timer wait
【视图】
侦测组视图
【参数】
seconds:一次侦测中的超时时间。取值范围为1~30,单位为秒,缺省值是2。
【描述】
timer wait命令用来设置一次侦测中的超时时间。undo timer wait命令用来将一次侦测中的超时时间恢复为缺省值。
【举例】
# 在侦测组10中,配置一次侦测中的超时时间为3秒。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] detect-group 10
[H3C-detect-group-10] timer wait 3
& 说明:
l 对于静态路由的详细介绍,请参见本手册中有关“路由协议”的章节。
l 对于VRRP的详细介绍,请参见本手册中有关“VRRP”的章节。
【命令】
ip route-static ip-address { mask | mask-length } { interface-type interface-number | next-hop } [ preference preference-value ] [ reject | blackhole ] detect-group group-number
undo ip route-static ip-address { mask | mask-length } [ interface-type interface-number | next-hop ] [ preference preference-value ]
【视图】
系统视图
【参数】
ip-address:IP地址(点分十进制格式)。
mask:子网掩码。
mask-length:子网掩码长度,即子网掩码中连续“1”的位数。
interface-type:下一跳出接口的类型。
interface-number:下一跳出接口的编号。
next-hop:下一跳IP地址(点分十进制格式)。
preference-value:为该路由的优先级别,取值范围1~255。
reject:指明为不可达路由。当到某一目的地的静态路由具有“reject”属性时,任何去往该目的地的IP报文都将被丢弃,并且通知源主机目的地不可达。
blackhole:指明为黑洞路由。当去往某一目的地的静态路由具有“blackhole”属性时,无论配置的下一跳地址是什么,该路由的出接口均为Null 0接口,任何去往该目的地的IP报文都将被丢弃,并且不通知源主机。
group-number:自动侦测组的编号,取值范围为1~50。
【描述】
ip route-static命令用来配置一条静态路由,并将侦测组返回的结果(可达或不可达)作为静态路由是否生效的一个必要条件:
l 当侦测组可达时,此静态路由生效;
l 当侦测组不可达时,此静态路由无效。
undo ip route-static命令用来取消所配置的静态路由。
【举例】
# 配置一条到192.168.0.5/24的静态路由,下一跳为192.168.0.2。如果侦测组10可达,则使该静态路由生效。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] ip route-static 192.168.0.5 24 192.168.0.2 detect-group 10
【命令】
standby detect-group group-number
undo standby detect-group
【视图】
VLAN接口视图
【参数】
group-number:自动侦测组的编号,取值范围为1~50。
【描述】
standby detect-group命令用来配置利用自动侦测组实现接口备份的功能。undo standby detect-group命令用来取消配置的接口备份功能。
用户可以利用自动侦测的返回结果来控制是否启用备份接口:
l 当侦测组可达时,使用主接口;
l 当侦测组不可达时,启用备份接口;
l 当链路恢复正常,侦测组又可达时,将重新启用主接口。
【举例】
# 当自动侦测组10不可达时,启用VLAN接口2作为备份口。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface vlan-interface 2
[H3C-Vlan-interface2] standby detect-group 10
【命令】
vrrp vrid virtual-router-id track detect-group group-number [ reduced value-reduced ]
undo vrrp vrid virtual-router-id track detect-group [ group-number ]
【视图】
VLAN接口视图
【参数】
virtual-router-id:虚拟路由器ID,取值范围为1~255。
group-number:自动侦测组的编号,取值范围为1~50。
value-reduced:优先级降低的数值,取值范围为1~255,缺省值为10。
【描述】
vrrp vrid命令用来启动在VRRP中的track侦测功能。undo vrrp vrid命令用来取消侦测功能。
用户可以利用自动侦测的返回结果来控制VRRP备份组的优先级,实现主备交换机的自动切换:
l 当侦测组不可达时,降低备份组的优先级;
l 当侦测组可达时,恢复备份组的优先级。
【举例】
# 创建侦测组10,配置侦测对象202.12.1.55。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] detect-group 10
[H3C-detect-group-10] detect-list 1 ip address 202.12.1.55
[H3C-detect-group-10] quit
# 当侦测组10不可达时,备份组1的优先级降低20。
[H3C] interface vlan-interface 2
[H3C-Vlan-interface2] vrrp vrid 1 track detect-group 10 reduced 20
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!