17-GRE命令
本章节下载: 17-GRE命令 (131.97 KB)
目 录
1.1.1 display gre p2mp tunnel-table interface tunnel
1.1.5 gre p2mp backup-interface
1.1.6 gre p2mp branch-network-mask
1.1.9 reset gre p2mp tunnel-table
【命令】
display gre p2mp tunnel-table interface tunnel number [ | { begin | exclude | include } regular-expression ]
【视图】
任意视图
【缺省级别】
1:监控级
【参数】
number:Tunnel接口号。
|:使用正则表达式对显示信息进行过滤。有关正则表达式的详细介绍,请参见“基础配置指导”中的“CLI”。
begin:从包含指定正则表达式的行开始显示。
exclude:只显示不包含指定正则表达式的行。
include:只显示包含指定正则表达式的行。
regular-expression:表示正则表达式,为1~256个字符的字符串,区分大小写。
【描述】
display gre p2mp tunnel-table interface tunnel命令用来显示指定点到多点GRE隧道接口的隧道表项信息。
【举例】
# 显示点到多点GRE隧道接口Tunnel0的隧道表项信息。
<Sysname> display gre p2mp tunnel-table interface tunnel 0
Dest Addr Mask Tunnel Dest Addr Gre Key
10.0.0.1 32 20.0.0.1
表1-1 display gre p2mp tunnel-table interface tunnel命令显示信息描述表
字段 |
描述 |
Dest Addr |
分支网络地址 |
Mask |
分支网络地址掩码 |
Tunnel Dest Addr |
隧道的目的地址 |
Gre Key |
GRE密钥,用来标识隧道表项的优先级,如果对端设备的隧道接口上没有配置GRE Key,则显示为空 |
【命令】
gre checksum
undo gre checksum
【视图】
Tunnel接口视图
【缺省级别】
2:系统级
【参数】
无
【描述】
gre checksum命令用来使能GRE报文校验和功能,从而验证报文的正确性,并丢掉验证不通过的报文。undo gre checksum命令用来取消GRE报文校验和功能。
缺省情况下,未使能GRE报文校验和功能。
相关配置可参考“三层技术-IP业务命令参考/隧道”中的命令interface tunnel和display interface tunnel。
【举例】
# 路由器Sysname1和Sysname2之间建立隧道,使能GRE报文校验和功能。在路由器Sysname1上使能GRE报文校验和功能。
<Sysname1> system-view
[Sysname1] interface tunnel 3
[Sysname1-Tunnel3] gre checksum
# 在路由器Sysname2上使能GRE报文校验和功能。
<Sysname2> system-view
[Sysname2] interface tunnel 2
[Sysname2-Tunnel2] gre checksum
【命令】
gre key key-number
undo gre key
【视图】
Tunnel接口视图
【缺省级别】
2:系统级
【参数】
key-number:GRE类型隧道接口的密钥,取值范围为0~4294967295。
【描述】
gre key命令用来设置GRE类型隧道接口的密钥。undo gre key命令用来取消GRE类型隧道接口的密钥。
缺省情况下,没有设置GRE类型隧道接口的密钥。
· 点到点GRE隧道中,收发双方进行GRE Key的验证,只有Tunnel两端设置的GRE Key完全一致时才能通过验证,否则将报文丢弃。GRE通过这种弱安全机制防止错误地识别或接收其它地方来的报文。
· 点到多点GRE隧道中,GRE Key用来标识隧道表项的优先级。GRE Key值越小,隧道表项的优先级越高。
相关配置可参考“三层技术-IP业务命令参考/隧道”中的命令interface tunnel和display interface tunnel。
【举例】
# 路由器Sysname1和Sysname2上分别设置GRE类型隧道接口的密钥为123。在路由器Sysname1上设置GRE类型隧道接口的密钥为123。
<Sysname1> system-view
[Sysname1] interface tunnel 3
[Sysname1-Tunnel3] gre key 123
# 在路由器Sysname2上设置GRE类型隧道接口的密钥为123。
<Sysname2> system-view
[Sysname2] interface tunnel 2
[Sysname2-Tunnel2] gre key 123
【命令】
gre p2mp aging-time aging-time
undo gre p2mp aging-time
【视图】
Tunnel接口视图
【缺省级别】
2:系统级
【参数】
aging-time:隧道表项老化时间值,取值范围为1~86400,单位为秒。
【描述】
gre p2mp aging-time命令用来配置点到多点GRE隧道的隧道表项老化时间。undo gre p2mp aging-time命令用来恢复缺省情况。
缺省情况下,隧道表项的老化时间为5秒。
需要注意的是:
· 该命令只在点到多点GRE隧道模式下可见。
· 如果中心节点在隧道表项老化时间内没有收到来自分支网络的报文,中心节点将删除分支网络对应的隧道表项。
· 隧道表项老化时间设置过小,可能导致表项过快老化,发往分支网络的报文转发失败;设置过大,可能会导致隧道表项无法及时更新。请根据实际情况,合理配置隧道表项老化时间。
【举例】
# 配置点到多点GRE隧道表项的老化时间为10秒。
<Sysname> system-view
[Sysname] interface tunnel 0
[Sysname-Tunnel0] gre p2mp aging-time 10
【命令】
gre p2mp backup-interface tunnel number
undo gre p2mp backup-interface
【视图】
Tunnel接口视图
【缺省级别】
2:系统级
【参数】
tunnel number:指定备份接口。其中,number为Tunnel接口号。
【描述】
gre p2mp backup-interface命令用来配置点到多点GRE隧道的备份接口。undo gre p2mp backup-interface命令用来恢复缺省情况。
缺省情况下,未指定备份接口。
需要注意的是:
· 该命令只在点到多点GRE隧道模式下可见。
· 指定的备份接口应为GRE over IPv4模式的隧道接口。
· 指定的备份接口必须是已经存在的隧道接口。
【举例】
# 配置备份接口为Tunnel100。
<Sysname> system-view
[Sysname] interface tunnel 0
[Sysname-Tunnel0] gre p2mp backup-interface tunnel 100
【命令】
gre p2mp branch-network-mask { mask | mask-length }
undo gre p2mp branch-network-mask
【视图】
Tunnel接口视图
【缺省级别】
2:系统级
【参数】
mask:分支网络私网IP地址的掩码,为点分十进制格式。
mask-length:分支网络私网IP地址的掩码长度,取值范围为0~32。
【描述】
gre p2mp branch-network-mask命令用来配置隧道表项中分支网络私网IP地址的掩码。undo gre p2mp branch-network-mask命令用来恢复缺省情况。
缺省情况下,分支网络私网IP地址的掩码为255.255.255.255,即掩码长度为32。
使用此命令配置掩码后,中心节点只会为属于同一个网段的私网IP地址建立一条隧道表项,从而减少中心节点上的表项数量,并保证分支网络可以通过模拟去往中心网络的数据流触发中心节点建立访问整个分支网络的隧道表项。
需要注意的是:
· 该命令只在点到多点GRE隧道模式下可见。
· 修改掩码会导致设备删除所有已经创建的隧道表项。因此,输入此命令后,需要用户手工确认是否执行此命令。
· 使用此命令前,需要保证企业网中所有分支网络的掩码长度一致,否则可能导致报文转发错误。如果不能保证所有分支网络的掩码长度一致,可以通过在分支侧设备上配置NAT来达到转换后IP地址掩码一致的效果。
【举例】
# 配置分支网络私网地址的掩码为255.255.255.0。
<Sysname> system-view
[Sysname] interface tunnel 0
[Sysname-Tunnel0] gre p2mp branch-network-mask 255.255.255.0
Warning: All tunnel table will be deleted. Continue? [Y/N]:
# 配置分支网络私网地址的掩码为23。
<Sysname> system-view
[Sysname] interface tunnel 0
[Sysname-Tunnel0] gre p2mp branch-network-mask 23
Warning: All tunnel table will be deleted. Continue? [Y/N]:
【命令】
gre recursion recursion-value
undo gre recursion
【视图】
Tunnel接口视图
【缺省级别】
2:系统级
【参数】
recursion-value:封装GRE头的Recursion Control字段值,取值范围为1~7。缺省值为0。
【描述】
gre recursion命令用来设置GRE头的Recursion Control字段值。undo gre recursion命令用来恢复缺省情况。
当不同厂商的设备使用GRE隧道嵌套出现互通性问题时,可以通过该命令设置GRE头的Recursion Control字段值。
缺省情况下,GRE头的Recursion Control字段值为0。
【举例】
# 在接口Tunnel 3上设置GRE头的Recursion Control字段值为1。
<Sysname> system-view
[Sysname] interface tunnel 3
[Sysname-Tunnel3] tunnel-protocol gre
[Sysname-Tunnel3] gre recursion 1
【命令】
keepalive [ seconds [ times ] ]
undo keepalive
【视图】
Tunnel接口视图
【缺省级别】
2:系统级
【参数】
seconds:keepalive报文发送周期,取值范围为1~32767,单位为秒,缺省值为10秒。
times:keepalive报文的最大传送次数,取值范围为1~255,缺省值为3次。
【描述】
keepalive命令用来使能GRE的keepalive功能,探测Tunnel接口状态,并配置keepalive报文发送周期及最大发送次数。undo keepalive命令关闭keepalive功能。
缺省情况下,没有使能GRE的keepalive功能。
当配置了该命令后,设备会从Tunnel接口定期发送GRE的keepalive报文。如果超时时间内没有收到隧道对端的回应,则本端重新发送keepalive报文。如果达到最大传送次数后仍然没有收到对端的回应,则把本端Tunnel接口的协议连接down掉。如果Tunnel接口为down状态,当收到对端回复的Keepalive确认报文时,Tunnel接口的状态将转换为up,否则保持down状态。
相关配置可参考“三层技术-IP业务命令参考/隧道”中的命令interface tunnel和display interface tunnel。
【举例】
# 配置GRE的keepalive报文发送周期为20s,最大传送次数为5次。
<Sysname> system-view
[Sysname] interface tunnel 0
[Sysname-Tunnel0] keepalive 20 5
【命令】
reset gre p2mp tunnel-table [ interface tunnel number [ dest-address tunnel-dest-address] ]
【视图】
用户视图
【缺省级别】
2:系统级
【参数】
interface tunnel number:清除指定隧道接口上的隧道表项。其中,number为Tunnel接口号。
dest-address tunnel-dest-address:清除指定隧道表项。其中,dest-address表示分支网络的私网IP地址,为点分十进制格式;tunnel-dest-address表示隧道目的地址,为点分十进制格式。
【描述】
reset gre p2mp tunnel-table命令用来清除点到多点GRE隧道的隧道表项信息。
如果没有指定隧道接口,则清除所有点到多点GRE隧道接口下的隧道表项信息。
【举例】
# 清除所有点到多点GRE隧道接口下的隧道表项信息。
<Sysname> reset gre p2mp tunnel-table
Warning: All tunnel table will be deleted. Continue? [Y/N]:
# 清除点到多点GRE隧道接口Tunnel0下的所有隧道表项信息。
<Sysname> reset gre p2mp tunnel-table interface tunnel 0
Warning: All tunnel table will be deleted. Continue? [Y/N]:
# 清除点到多点GRE隧道接口Tunnel0下的指定隧道表项:分支网络的私网地址为10.0.0.1,隧道目的地址为20.0.0.1。
<Sysname> reset gre p2mp tunnel-table interface tunnel 0 10.0.0.1 20.0.0.1
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!