12-MSR系列路由器GRE over IPsec典型配置举例
本章节下载: 12-MSR系列路由器GRE over IPsec典型配置举例 (141.88 KB)
MSR系列路由器GRE over IPsec典型配置举例
Copyright © 2014杭州华三通信技术有限公司 版权所有,保留一切权利。 非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部, 并不得以任何形式传播。本文档中的信息可能变动,恕不另行通知。 |
目 录
本文档介绍GRE over IPsec的典型配置举例。
本文档不严格与具体软、硬件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文档假设您已了解GRE和IPsec特性。
如图1所示,IP network A的接入路由器采用RouterA,IP network B的接入路由器采用RouterB,采用GRE技术通过VPN相连。要求:为进一步保障两公司之间的数据机密性,需要在现有VPN的基础上,启用IPSec对数据进行加密保护。
图1 GRE over IPSec配置组网图
· 通过配置静态路由穿越GRE隧道,从而使两端私网之间可以互通。
· 将IPsec与GRE结合使用,可以对通过GRE隧道的路由即两端私网间的通信进行保护。
· 将ACL中源、目的IP地址与建立GRE隧道的源、目的IP地址配置相同,可以对整个GRE隧道进行保护
本举例是在Release 2317版本上进行配置和验证的。
由于GRE over IPSec将对GRE封装后的数据进行IPSec封装,因此在配置访问控制列表时,需要匹配经GRE封装后的数据流。
# 配置接口Ethernet0/1的IP地址。
<RouterA> system-view
[RouterA] interface ethernet 0/1
[RouterA-Ethernet0/1] ip address 30.1.1.1 8
[RouterA-Ethernet0/1] quit
# 配置GRE隧道。
[RouterA] interface tunnel 1
[RouterA-Tunnel1] ip address 11.1.1.1 8
[RouterA-Tunnel1] Source 10.1.1.1
[RouterA-Tunnel1] destination 10.1.1.2
[RouterA-Tunnel1] quit
# 配置静态路由。
[RouterA] ip route-static 40.0.0.0 255.0.0.0 Tunnel1
# 创建ACL3000,定义需要IPsec保护的数据流。
[RouterA] acl number 3000
[RouterA-acl-adv-3000] rule permit ip source 10.1.1.1 0.0.0.0 destination 10.1.1.2 0.0.0.0
[RouterA-acl-adv-3000] rule deny ip source any destination any
[RouterA-acl-adv-3000] quit
# 创建IKE对等体。
[RouterA] ike peer test
[RouterA-ike-peer-test] pre-shared-key test
[RouterA-ike-peer-test] remote-address 10.1.1.2
[RouterA-ike-peer-test] quit
# 创建IPsec安全提议。
[RouterA] ipsec proposal test
[RouterA-ipsec-proposal-test] encapsulation-mode tunnel
[RouterA-ipsec-proposal-test] transform esp
[RouterA-ipsec-proposal-test] esp encryption-algorithm 3des
[RouterA-ipsec-proposal-test] esp authentication-algorithm sha
[RouterA-ipsec-proposal-test] quit
# 创建IPsec安全策略。
[RouterA] ipsec policy test 1 isakmp
[RouterA-ipsec-policy-isakmp-test-1] security acl 3000
[RouterA-ipsec-policy-isakmp-test-1] ike-peer test
[RouterA-ipsec-policy-isakmp-test-1] proposal test
[RouterA-ipsec-policy-isakmp-test-1] quit
# 在接口Ethernet0/0上应用IPsec安全策略。
[RouterA] interface ethernet 0/0
[RouterA-Ethernet0/0] ipsec policy test
[RouterA-Ethernet0/0] ip address 10.1.1.1 8
[RouterA-Ethernet0/0] quit
# 配置接口Ethernet0/1的IP地址。
<RouterB> system-view
[RouterB] interface ethernet 0/1
[RouterB-Ethernet0/1] ip address 40.1.1.1 8
[RouterB-Ethernet0/1] quit
# 配置GRE隧道。
[RouterB] interface tunnel 1
[RouterB-Tunnel1] ip address 11.1.1.2 8
[RouterB-Tunnel1] source 10.1.1.2
[RouterB-Tunnel1] destination 10.1.1.1
[RouterB-Tunnel1] quit
# 配置静态路由。
[RouterB] ip route-static 30.0.0.0 255.0.0.0 Tunnel1
# 创建ACL3000,定义需要IPsec保护的数据流。
[RouterB] acl number 3000
[RouterB-acl-adv-3000] rule permit ip source 10.1.1.2 0.0.0.0 destination 10.1.1.1 0.0.0.0
[RouterB-acl-adv-3000] rule deny ip source any destination any
[RouterB-acl-adv-3000] quit
# 创建IKE对等体。
[RouterB] ike peer test
[RouterB-ike-peer-test] pre-shared-key test
[RouterB-ike-peer-test] remote-address 10.1.1.1
[RouterB-ike-peer-test] quit
# 创建IPsec安全提议。
[RouterB] ipsec proposal test
[RouterB-ipsec-proposal-test] encapsulation-mode tunnel
[RouterB-ipsec-proposal-test] transform esp
[RouterB-ipsec-proposal-test] esp encryption-algorithm 3des
[RouterB-ipsec-proposal-test] esp authentication-algorithm sha
[RouterB-ipsec-proposal-test] quit.
# 创建IPsec安全策略。
[RouterB] ipsec policy test 1 isakmp
[RouterB-ipsec-policy-isakmp-test-1] security acl 3000
[RouterB-ipsec-policy-isakmp-test-1] ike-peer test
[RouterB-ipsec-policy-isakmp-test-1] proposal test
[RouterB-ipsec-policy-isakmp-test-1] quit
# 在接口Ethernet0/0上应用IPsec安全策略。
[RouterB] interface ethernet 0/0
[RouterB-Ethernet0/0] ipsec policy test
[RouterB-Ethernet0/0] ip address 10.1.1.2 8
[RouterB-Ethernet0/0] quit
(1) 查看IKE SA
配置完成后从30.1.1.1 ping 40.1.1.1,会触发IPsec协商,建立IPsec隧道。在成功建立IPsec隧道后,可以ping通。在系统视图下使用display ike sa命令,可以看到两个阶段的SA正常建立,以Router A为例:
[RouterA] display ike sa
total phase-1 SAs: 1
connection-id peer flag phase doi
----------------------------------------------------------
1 10.1.1.2 RD|ST 1 IPSEC
2 10.1.1.2 RD|ST 2 IPSEC
flag meaning
RD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO—TIMEOUT
(2) 查看ipsec sa
在系统视图下使用display ipsec sa命令可以看到ipsec sa的建立情况。以Router A为例:
[RouterA] display ipsec sa
===============================
Interface: Ethernet0/0
path MTU: 1500
===============================
-----------------------------
IPsec policy name: "test"
sequence number: 1
mode: isakmp
-----------------------------
connection id: 1
encapsulation mode: tunnel
perfect forward secrecy:
tunnel:
local address: 10.1.1.1
remote address: 10.1.1.2
flow:
sour addr: 10.1.1.1/255.255.255.255 port: 0 protocol: IP
dest addr: 10.1.1.2/255.255.255.255 port: 0 protocol: IP
[inbound ESP SAs]
spi: 1149793347 (0x44887443)
proposal: ESP-ENCRYPT-3DES ESP-AUTH-SHA1
sa duration (kilobytes/sec): 1843200/3600
sa remaining duration (kilobytes/sec): 1843199/3471
max received sequence-number: 5
anti-replay check enable: Y
anti-replay window size: 32
udp encapsulation used for nat traversal: N
[outbound ESP SAs]
spi: 2381952527 (0x8df9b60f)
proposal: ESP-ENCRYPT-3DES ESP-AUTH-SHA1
sa duration (kilobytes/sec): 1843200/3600
sa remaining duration (kilobytes/sec): 1843198/3471
max received sequence-number: 12
udp encapsulation used for nat traversal: N
· Router A:
#
acl number 3000
rule 0 permit ip source 10.1.1.1 0 destination 10.1.1.2 0
rule 5 deny ip
#
ike peer test
pre-shared-key cipher pTHDptKNjg0=
remote-address 10.1.1.2
#
ipsec proposal test
esp authentication-algorithm sha1
esp encryption-algorithm 3des
#
ipsec policy test 1 isakmp
security acl 3000
ike-peer test
proposal test
#
interface Ethernet0/0
port link-mode route
ip address 10.1.1.1 255.0.0.0
ipsec policy test
#
interface Ethernet0/1
port link-mode route
ip address 30.1.1.1 255.0.0.0
#
interface Tunnel1
ip address 11.1.1.1 255.0.0.0
source 10.1.1.1
destination 10.1.1.2
#
ip route-static 40.0.0.0 255.0.0.0 Tunnel1
#
· Router B:
#
acl number 3000
rule 0 permit ip source 10.1.1.2 0 destination 10.1.1.1 0
rule 5 deny ip
#
ike peer test
pre-shared-key cipher pTHDptKNjg0=
remote-address 10.1.1.1
#
ipsec proposal test
esp authentication-algorithm sha1
esp encryption-algorithm 3des
#
ipsec policy test 1 isakmp
security acl 3000
ike-peer test
proposal test
#
interface Ethernet0/0
port link-mode route
ip address 10.1.1.2 255.0.0.0
ipsec policy test
#
interface Ethernet0/1
port link-mode route
ip address 40.1.1.1 255.0.0.0
#
interface Tunnel1
ip address 11.1.1.2 255.0.0.0
source 10.1.1.2
destination 10.1.1.1
#
ip route-static 30.0.0.0 255.0.0.0 Tunnel1
#
· H3C MSR 系列路由器 命令参考(V5)-R2311
· H3C MSR 系列路由器 配置指导(V5)-R2311
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!