• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

10-GRE配置

目录

01-H3C 路由器 GRE over IPv4隧道典型配置

本章节下载 01-H3C 路由器 GRE over IPv4隧道典型配置  (184.28 KB)

01-H3C 路由器 GRE over IPv4隧道典型配置

H3C路由器

GRE over IPv4隧道典型配置

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Copyright © 2024 新华三技术有限公司 版权所有,保留一切权利。

非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。

除新华三技术有限公司的商标外,本手册中出现的其它公司的商标、产品标识及商品名称,由各自权利人拥有。

本文档中的信息可能变动,恕不另行通知。



1 简介

本文档介绍GRE over IPv4隧道典型配置举例。

2 配置前提

本文档适用于使用Comware V7软件版本的路由器,如果使用过程中与产品实际情况有差异,请以设备实际情况为准。

本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。

本文档假设您已了解GRE隧道特性。

3 典型配置

3.1  组网需求

图3-1所示,Device A和Device B以固定地址方式连接Internet。在Device A和Device B之间建立一个GRE over IPv4隧道,对Host A和Host B之间的数据流进行安全保护。

图3-1 GRE over IPv4隧道典型配置组网图

 

3.2  配置注意事项

在开始配置之前,请确保Device A和Device B已连接Internet,Device A的GE1/0/2接口与Device B的GE1/0/2接口之间IPv4报文路由可达。

3.3  配置步骤

3.3.1  配置Device A

# 配置接口GigabitEthernet1/0/1的IP地址。

<DeviceA> system-view

[DeviceA] interface gigabitethernet 1/0/1

[DeviceA-GigabitEthernet1/0/1] ip address 192.168.1.1 255.255.255.0

[DeviceA-GigabitEthernet1/0/1] quit

# 配置接口GigabitEthernet1/0/2的IP地址。

[DeviceA] interface gigabitethernet 1/0/2

[DeviceA-GigabitEthernet1/0/2] ip address 1.1.1.1 255.255.255.0

[DeviceA-GigabitEthernet1/0/2] quit

# 创建Tunnel0接口,并指定隧道模式为GRE over IPv4隧道。

[DeviceA] interface tunnel 0 mode gre

# 配置Tunnel0接口的IP地址。

[DeviceA-Tunnel0] ip address 10.1.2.1 255.255.255.0

# 配置Tunnel0接口的源端地址(Device A的接口GigabitEthernet1/0/2的IP地址)。

[DeviceA-Tunnel0] source 1.1.1.1

# 配置Tunnel0接口的目的端地址(Device B的接口GigabitEthernet1/0/2的IP地址)。

[DeviceA-Tunnel0] destination 2.2.2.2

[DeviceA-Tunnel0] quit

# 配置经过Tunnel0接口到Host B所在子网的静态路由。

[DeviceA] ip route-static 192.168.2.0 255.255.255.0 Tunnel 0

3.3.2  配置Device B

# 配置接口GigabitEthernet1/0/1的IP地址。

<DeviceB> system-view

[DeviceB] interface gigabitethernet 1/0/1

[DeviceB-GigabitEthernet1/0/1] ip address 192.168.2.1 255.255.255.0

[DeviceB-GigabitEthernet1/0/1] quit

# 配置接口GigabitEthernet1/0/2的IP地址。

[DeviceB] interface gigabitethernet 1/0/2

[DeviceB-GigabitEthernet1/0/2] ip address 2.2.2.2 255.255.255.0

[DeviceB-GigabitEthernet1/0/2] quit

# 创建Tunnel0接口,并指定隧道模式为GRE over IPv4隧道。

[DeviceB] interface tunnel 0 mode gre

# 配置Tunnel0接口的IP地址。

[DeviceB-Tunnel0] ip address 10.1.2.2 255.255.255.0

# 配置Tunnel0接口的源端地址(Device B的接口GigabitEthernet1/0/2的IP地址)。

[DeviceB-Tunnel0] source 2.2.2.2

# 配置Tunnel0接口的目的端地址(Device A的接口GigabitEthernet1/0/2的IP地址)。

[DeviceB-Tunnel0] destination 1.1.1.1

[DeviceB-Tunnel0] quit

# 配置经过Tunnel0接口到Host A所在子网的静态路由。

[DeviceB] ip route-static 192.168.1.0 255.255.255.0 Tunnel 0

3.4  验证配置

# 从Host A可以ping通Host B。

C:\Users> ping 192.168.2.2

 

Pinging 192.168.2.2 with 32 bytes of data:

 

Reply from 192.168.2.2: bytes=32 time=19ms TTL=253

Reply from 192.168.2.2: bytes=32 time<1ms TTL=253

Reply from 192.168.2.2: bytes=32 time<1ms TTL=253

Reply from 192.168.2.2: bytes=32 time<1ms TTL=253

 

Ping statistics for 192.168.2.2:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 19ms, Average = 4ms

3.5  配置文件

·     Device A

#

interface GigabitEthernet1/0/1

 ip address 192.168.1.1 255.255.255.0

#

interface GigabitEthernet1/0/2

 ip address 1.1.1.1 255.255.255.0

#

interface Tunnel0 mode gre

 source 1.1.1.1

 destination 2.2.2.2

 ip address 10.1.2.1 255.255.255.0

#

ip route-static 192.168.2.0 255.255.255.0 Tunnel 0

#

·     Device B

#

interface GigabitEthernet1/0/1

 ip address 192.168.2.1 255.255.255.0

#

interface GigabitEthernet1/0/2

 ip address 2.2.2.2 255.255.255.0

#

interface Tunnel0 mode gre

 source 2.2.2.2

 destination 1.1.1.1

 ip address 10.1.2.2 255.255.255.0

#

ip route-static 192.168.1.0 255.255.255.0 Tunnel 0

#

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们