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

H3C SecPath F3200-I工控防火墙 典型配置-5W101

49-GRE隧道典型配置举例

本章节下载  (154.25 KB)

49-GRE隧道典型配置举例


1  简介

通用路由封装(GRE)定义了在任意一种网络层协议上封装任意一个其它网络层协议的协议,通过创建一条点到点的tunnel来完成二次封装数据的转发,且GRE隧道只支持点到点的业务接入。

GRE是三层的隧道协议,它利用一种协议的传输能力为另一种协议建立了点到点的隧道,被封装的报文将在隧道的两端进行封装和解封装。使用GRE协议可以与对端网关设备建立虚拟的、点对点通信,GRE仅对报文进行封装而不加密。

简单说,GRE的是将3层报文封装到IP报文里,送到tunnel对端后再解开的技术。

2  配置前提

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

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

3  GRE over IPSec 配置举例

3.1  组网需求

设备 A和设备 B之间建立GRE隧道Tunnel0,Tunnel0的网段为172.16.1.0/24。另外,我们还需要在GRE隧道上运行动态路由协议OSPF,使设备 A和设备 B彼此通过动态路由协议学习到对方站点身后网络路由(1.1.1.0/24和2.2.2.0/24)。最后配置IPSec VPN,以对两个站点间的GRE流量进行加密。

 

3.2  配置思路

(1)     配置网络接口;

(2)     配置GRE隧道;

(3)     配置动态路由协议OSPF;

(4)     配置IPSec VPN保护站点间GRE流量;

(5)     在GRE隧道中指定下一跳;

(6)     配置GRE路由。

3.3  使用版本

本举例是在E6501及以上版本进行配置和验证的。

3.4  配置步骤

(1)     基本网络配置

设备 A:

host(config)# interface ge2

host(config-ge2)#ip address 202.100.1.1/24

host(config-ge2)# allow access all

host(config)# interface lo0

host(config-lo0)#ip address 1.1.1.1/24

host(config-lo0)## allow access all

host(config)#ip route 0.0.0.0/0 202.100.1.10

 

Internet:

host(config)# interface ge3

host(config-ge3)#ip address 202.100.1.10/24

host(config-ge3)# allow access all

host(config)# interface ge4

host(config-ge4)#ip address 61.128.1.10/24

host(config-ge4)# allow access all

 

设备 B:

host(config)# interface ge2

host(config-ge2)#ip address 61.128.1.1/24

host(config-ge2)# allow access all

host(config)# interface lo0

host(config-lo0)#ip address 2.2.2.1/24

host(config-lo0)## allow access all

host(config)#ip route 0.0.0.0/0 61.128.1.10

 

(2)     配置GRE隧道

配置设备 A的GRE隧道:

host(config)# interface tunnel 0 mode gre

host(config-tunnel0)#ip address 172.16.1.1/24

host(config-tunnel0)#tunnel source 202.100.1.1

host(config-tunnel0)#tunnel destination 61.128.1.1

host(config-tunnel0)#allow access all

 

配置设备 B的GRE隧道:

host(config)# interface tunnel 0 mode gre

host(config-tunnel0)#ip address 172.16.1.2/24

host(config-tunnel0)#tunnel source 61.128.1.1

host(config-tunnel0)#tunnel destination 202.100.1.1

host(config-tunnel0)#allow access all

 

(3)     配置动态路由协议OSPF

配置设备 A的动态路由协议OSPF:

host(config)# router ospf

host(config-ospf)# network 172.16.1.0/24 area 0

host(config-ospf)# network 1.1.1.0/24 area 0

 

配置设备 B的动态路由协议OSPF:

host(config)# router ospf

host(config-ospf)# network 172.16.1.0/24 area 0

host(config-ospf)# network 2.2.2.0/24 area 0

 

(4)     配置IPSec VPN保护站点间GRE流量

设备 A一阶段:

host# configure terminal

host(config)# vpn ipsec phase1

host(config-phase1)# edit gateway ph1

host(config-phase1-ph1)# set mode main

host(config-phase1-ph1)# set remotegw 61.128.1.1

host(config-phase1-ph1)# authentication pre-share

host(config-phase1-ph1)# set preshared-key 123456

host(config-phase1-ph1)# lifetime 86400

host(config-phase1-ph1)# set dpd retry 5

host(config-phase1-ph1)# set nat 10

host(config-phase1-ph1)# group 1

host(config-phase1-ph1)# set policy 1

host(config-phase1-ph1-policy1)# encrypt 3des

host(config-phase1-ph1-policy1)# hash md5

host(config-phase1-ph1-policy1)# exit

host(config-phase1-ph1)# exit   

host(config-phase1)# exit

 

设备 A二阶段:

host(config)# vpn ipsec phase2

host(config-phase2)# edit tunnel ph2

 

host(config-phase2-ph2)# set peer ph1

host(config-phase2-ph2)# mode tunnel

host(config-phase2-ph2)# set proposal

host(config-phase2-ph2)# set peer ph1

host(config-phase2-ph2)# mode tunnel

host(config-phase2-ph2)# set proposal1 esp-3des-md5 ah-null

host(config-phase2-ph2)# exit

 

设备 A加密隧道:

host(config)# interface tunnel 1 mode ipsec

host(config-tunnel1)#tunnel-ipsec ph2

host(config-tunnel1)#tunnel-ipsec interested-subnet pair 202.100.1.1/24 61.128.1.1/24

 

设备 B一阶段:

host# configure terminal

host(config)# vpn ipsec phase1

host(config-phase1)# edit gateway ph1

host(config-phase1-ph1)# set mode main

host(config-phase1-ph1)# set remotegw 202.100.1.1

host(config-phase1-ph1)# authentication pre-share

host(config-phase1-ph1)# set preshared-key 123456

host(config-phase1-ph1)# lifetime 86400

host(config-phase1-ph1)# set dpd retry 5

host(config-phase1-ph1)# set nat 10

host(config-phase1-ph1)# group 1

host(config-phase1-ph1)# set policy 1

host(config-phase1-phypt 1-policy1)# encr 3des

host(config-phase1-ph1-policy1)# hash md5

host(config-phase1-ph1-policy1)# exit

host(config-phase1-ph1)# exit   

host(config-phase1)# exit

 

设备 B二阶段:

host(config)# vpn ipsec phase2

host(config-phase2)# edit tunnel ph2

host(config-phase2-ph2)# set peer ph1

host(config-phase2-ph2)# mode tunnel

host(config-phase2-ph2)# set proposal1 esp-3des-md5 ah-null

host(config-phase2-ph2)# exit

 

设备 B加密隧道:

host(config)# interface tunnel 1 mode ipsec

host(config-tunnel1)#tunnel-ipsec ph2

host(config-tunnel1)#tunnel-ipsec interested-subnet pair 61.128.1.1/24 202.100.1.1/24

 

(5)     在GRE隧道中指定下一跳

设备 A:

host(config)# interface tunnel 0 mode gre

host(config-tunnel0)#next-tunnel tunnel 1

 

设备 B:

host(config)# interface tunnel 0 mode gre

host(config-tunnel0)#next-tunnel tunnel 1

 

(6)     配置GRE路由

配置设备 A的GRE路由:

host(config)# ip route 2.2.2.0/24 tunnel0

 

配置设备 B的GRE路由:

host(config)# ip route 1.1.1.0/24 tunnel0

 

3.5  验证配置

3.5.1  查看设备 A的GRE接口状态

host(config)# display interface tunnel0

----------------------------------------------------------------------

interface tunnel1

description:

        Admin UP   Link UP

        kernel ID: 35

        MTU: 1476

        IP address: 172.16.1.1/24

 

        tunnel mode: gre

        tunnel source addr: 202.100.1.1 (ge2)

        tunnel destination addr: 161.128.1.1

3.5.2  查看设备 B的GRE接口状态

host(config)# display interface tunnel0

----------------------------------------------------------------------

interface tunnel1

description:

        Admin UP   Link UP

        kernel ID: 35

        MTU: 1476

        IP address: 172.16.1.2/24

 

        tunnel mode: gre

        tunnel source addr: 161.128.1.1 (ge2)

        tunnel destination addr: 202.100.1.1

3.5.3  查看设备 B的GRE隧道口流量转发

host# display statistics interface

 

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

新华三官网
联系我们