HCMSR系列路由器IPsec典型配置举例V图文稿
H C M S R系列路由器
I P s e c典型配置举例V
集团文件版本号:(M928-T898-M248-WU2669-I2896-DQ586-M1988)
1?简介
本文档介绍IPsec的典型配置举例。
2?配置前提
本文档适用于使用Comware V7软件版本的MSR系列路由器,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文档假设您已了解IPsec特性。
3?使用iNode客户端基于证书认证的L2TP over IPsec功能配置举例
3.1?组网需求
如所示,PPP用户Host与Device建立L2TP隧道,Windows server 2003作为CA服务器,要求:
通过L2TP隧道访问Corporate network。
用IPsec对L2TP隧道进行数据加密。
采用RSA证书认证方式建立IPsec隧道。
图1基于证书认证的L2TP over IPsec配置组网图
3.2?配置思路
由于使用证书认证方式建立IPsec隧道,所以需要在ike profile
中配置local-identity为dn,指定从本端证书中的主题字段取得
本端身份。
3.3?使用版本
本举例是在R0106版本上进行配置和验证的。
3.4?配置步骤
3.4.1?Device的配置
(1)配置各接口IP地址
#配置接口GigabitEthernet2/0/1的IP地址。
[Device] interface gigabitethernet 2/0/1
[Device-GigabitEthernet2/0/1] quit
#配置接口GigabitEthernet2/0/2的IP地址。
[Device] interface gigabitethernet 2/0/2
[Device-GigabitEthernet2/0/2] quit
#配置接口GigabitEthernet2/0/3的IP地址。
[Device] interface gigabitethernet 2/0/3
[Device-GigabitEthernet2/0/3] quit
(2)配置L2TP
#创建本地PPP用户l2tpuser,设置密码为hello。
[Device] local-user l2tpuser class network
[Device-luser-network-l2tpuser] password simple hello [Device-luser-network-l2tpuser] service-type ppp
[Device-luser-network-l2tpuser] quit
#配置ISP域system对PPP用户采用本地验证。
[Device] domain system
[Device-isp-system] authentication ppp local
[Device-isp-system] quit
#启用L2TP服务。
[Device] l2tp enable
#创建接口Virtual-Template0,配置接口的IP地址为。[Device] interface virtual-template 0
#配置PPP认证方式为PAP。
[Device-Virtual-Template0] ppp authentication-mode pap #配置为PPP用户分配的IP地址为。
[Device-Virtual-Template0] quit
#创建LNS模式的L2TP组1。
[Device] l2tp-group 1 mode lns
#配置LNS侧本端名称为lns。
[Device-l2tp1] tunnel name lns
#关闭L2TP隧道验证功能。
[Device-l2tp1] undo tunnel authentication
#指定接收呼叫的虚拟模板接口为VT0。
[Device-l2tp1] allow l2tp virtual-template 0
[Device-l2tp1] quit
(3)配置PKI证书
#配置PKI实体security。
[Device] pki entity security
[Device-pki-entity-security] common-name device
[Device-pki-entity-security] quit
#新建PKI域。
[Device] pki domain headgate
[Device-pki-domain-headgate] ca identifier LYQ
[Device-pki-domain-headgate] certificate request from ra [Device-pki-domain-headgate] certificate request entity security
[Device-pki-domain-headgate] undo crl check enable
[Device-pki-domain-headgate]public-key rsa general name abc length 1024
[Device-pki-domain-headgate] quit
#生成RSA算法的本地密钥对。
[Device] public-key local create rsa name abc
The range of public key modulus is (512 ~ 2048).
If the key modulus is greater than 512,it will take a few minutes.
Press CTRL+C to abort.
Input the modulus length [default = 1024]:
Generating Keys... ..........................++++++
.++++++
Create the key pair successfully.
#获取CA证书并下载至本地。
[Device] pki retrieve-certificate domain headgate ca
The trusted CA's finger print is:
MD5 fingerprint:8649 7A4B EAD5 42CF 5031 4C99 BFS3 2A99
SHA1 fingerprint:61A9 6034 181E 6502 12FA 5A5F BA12 0EA0 5187 031C
Is the finger print correct(Y/N):y
Retrieved the certificates successfully.
#手工申请本地证书。
[Device] pki request-certificate domain headgate
Start to request general certificate ...
Certificate requested successfully.
(4)配置IPsec隧道
#创建IKE安全提议。
[Device] ike proposal 1
[Device-ike-proposal-1] authentication-method rsa-signature [Device-ike-proposal-1] encryption-algorithm 3des-cbc [Device-ike-proposal-1] dh group2
[Device-ike-proposal-1] quit
#配置IPsec安全提议。
[Device] ipsec transform-set tran1
[Device-ipsec-transform-set-tran1] esp authentication-algorithm sha1
[Device-ipsec-transform-set-tran1] esp encryption-algorithm 3des
[Device-ipsec-transform-set-tran1] quit
#配置IKE profile。
[Device] ike profile profile1
[Device-ike-profile-profile1] local-identity dn
[Device-ike-profile-profile1] certificate domain headgate [Device-ike-profile-profile1] proposal 1
[Device-ike-profile-profile1] match remote certificate device
[Device-ike-profile-profile1] quit
#在采用数字签名认证时,指定总从本端证书中的主题字段取得本端身份。
[Device]ike signature-identity from-certificate
#创建一条IPsec安全策略模板,名称为template1,序列号为1。[Device]ipsec policy-template template1 1
[Device-ipsec-policy-template-template1-1] transform-set tran1
[Device-ipsec-policy-template-template1-1] ike-profile profile1
[Device-ipsec-policy-template-template1-1] quit
#引用IPsec安全策略模板创建一条IPsec安全策略,名称为
policy1,顺序号为1。
[Device] ipsec policy policy1 1 isakmp template template1 #在接口上应用IPsec安全策略。
[Device] interface gigabitethernet 2/0/2
[Device-GigabitEthernet2/0/2] ipsec apply policy policy1 [Device-GigabitEthernet2/0/2] quit
3.4.2?Host的配置
(1)从证书服务器上申请客户端证书
#登录到证书服务器:,点击“申请一个证书”。
图1进入申请证书页面
#点击“高级证书申请”。
图2高级证书申请
#选择第一项:创建并向此CA提交一个申请。
图3创建并向CA提交一个申请
#填写相关信息。
需要的证书类型,选择“客户端身份验证证书”;
密钥选项的配置,勾选“标记密钥为可导出”前的复选框。
#点击<提交>,弹出一提示框:在对话框中选择“是”。
#点击安装此证书。
图4安装证书
(2)iNode客户端的配置(使用iNode版本为:iNode PC
5.2(E0409))
#打开L2TP VPN连接,并单击“属性…(Y)”。
图5打开L2TP连接
#输入LNS服务器的地址,并启用IPsec安全协议,验证证方法选择证书认证。
图6基本配置
#单击<高级(C)>按钮,进入“L2TP设置”页签,设置L2TP参数如下图所示。
图7L2TP设置
#单击“IPsec设置”页签,配置IPsec参数。
图8IPsec参数设置
#单击“IKE设置”页签,配置IKE参数。
图9IKE参数设置
#单击“路由设置”页签,添加访问Corporate network的路由。
图10路由设置
#完成上述配置后,单击<确定>按钮,回到L2TP连接页面。
3.5?验证配置
#在L2TP连接对话框中,输入用户名“l2tpuser”和密码
“hello”,单击<连接>按钮。
图11连接L2TP
#在弹出的对话框中选择申请好的证书,单击<确定>按钮。
图12证书选择
#通过下图可以看到L2TP连接成功。
图13连接成功
图14连接成功
#在Device上使用display ike sa命令,可以看到IPsec隧道第一阶段的SA正常建立。
Connection-ID Remote Flag DOI
------------------------------------------------------------------
Flags:
RD--READY RL--REPLACED FD-FADING
#在Device上使用display ipsec sa命令可以看到IPsec SA的建立情况。
-------------------------------
Interface: GigabitEthernet2/0/2
-------------------------------
-----------------------------
IPsec policy: policy1
Sequence number: 1
Mode: template
-----------------------------
Tunnel id: 0
Encapsulation mode: tunnel
Perfect forward secrecy:
Path MTU: 1443
Tunnel:
Flow:
[Inbound ESP SAs]
Transform set: ESP-ENCRYPT-3DES-CBC ESP-AUTH-SHA1 SA duration (kilobytes/sec): 1843200/3600
SA remaining duration (kilobytes/sec): 1843197/3294 Max received sequence-number: 51
Anti-replay check enable: Y
Anti-replay window size: 64
UDP encapsulation used for NAT traversal: N
Status: Active
[Outbound ESP SAs]
Transform set: ESP-ENCRYPT-3DES-CBC ESP-AUTH-SHA1 SA duration (kilobytes/sec): 1843200/3600
SA remaining duration (kilobytes/sec): 1843197/3294 Max sent sequence-number: 52
UDP encapsulation used for NAT traversal: N
Status: Active
3.6?配置文件
#
interface Virtual-Template0
ppp authentication-mode pap
#
interface GigabitEthernet2/0/1
#
interface GigabitEthernet2/0/2
ipsec apply policy policy1
#
interface GigabitEthernet2/0/3
#
domain system
authentication ppp local
#
local-user l2tpuser class network
password cipher $c$3$nl46fURLtkCkcbdnB6irTXma+E6u0c+h service-type ppp
authorization-attribute user-role network-operator
#
pki domain headgate
ca identifier LYQ
certificate request from ra
certificate request entity security
public-key rsa general name abc
undo crl check enable
#
pki entity security
common-name host
#
ipsec transform-set tran1
esp encryption-algorithm 3des-cbc
esp authentication-algorithm sha1
#
ipsec policy-template template1 1
transform-set tran1
ike-profile profile1
#
ipsec policy policy1 1 isakmp template template1 #
l2tp-group 1 mode lns
allow l2tp virtual-template 0
undo tunnel authentication
tunnel name lns
#
l2tp enable
#
ike signature-identity from-certificate
#
ike profile profile1
certificate domain headgate
local-identity dn
match remote certificate device
proposal 1
#
ike proposal 1
authentication-method rsa-signature
encryption-algorithm 3des-cbc
dh group2
#
4?IPsec over GRE的典型配置举例
4.1?组网需求
如所示,企业远程办公网络通过IPsec VPN接入企业总部,要求:通过GRE隧道传输两网络之间的IPsec加密数据。
图15IPsec over GRE组网图
4.2?配置思路
为了对数据先进行IPsec处理,再进行GRE封装,访问控制列表需匹配数据的原始范围,并且要将IPsec应用到GRE隧道接口
上。
为了对网络间传输的数据先进行IPsec封装,再进行GRE封装,需要配置IPsec隧道的对端IP地址为GRE隧道的接口地址。4.3?使用版本
本举例是在R0106版本上进行配置和验证的。
4.4?配置步骤
4.4.1?Device A的配置
(1)配置各接口IP地址
#配置接口GigabitEthernet2/0/1的IP地址。
[DeviceA] interface gigabitethernet 2/0/1
[DeviceA-GigabitEthernet2/0/1] tcp mss 1350
[DeviceA-GigabitEthernet2/0/1] quit
#配置接口GigabitEthernet2/0/2的IP地址。
[DeviceA] interface gigabitethernet 2/0/2
[DeviceA-GigabitEthernet2/0/2] quit
(2)配置GRE隧道
#创建Tunnel0接口,并指定隧道模式为GRE over IPv4隧道。
[DeviceA] interface tunnel 0 mode gre
#配置Tunnel0接口的IP地址为。
#配置Tunnel0接口的源端地址为(Device A的
GigabitEthernet2/0/2的IP地址)。
#配置Tunnel0接口的目的端地址为(Device B的GigabitEthernet2/0/2的IP地址)。
[DeviceA-Tunnel0] quit
#配置从Device A经过Tunnel0接口到Remote office network的静态路由。
(3)配置IPsec VPN
#配置IKE keychain。
[DeviceA] ike keychain keychain1
[DeviceA-ike-keychain-keychain1] quit
#创建ACL3000,定义需要IPsec保护的数据流。
[DeviceA] acl number 3000
[DeviceA-acl-adv-3000] quit
#配置IPsec安全提议。
[DeviceA] ipsec transform-set tran1
[DeviceA-ipsec-transform-set-tran1] esp encryption-algorithm des
[DeviceA-ipsec-transform-set-tran1] esp authentication-algorithm sha1
[DeviceA-ipsec-transform-set-tran1] quit
#创建一条IKE协商方式的IPsec安全策略,名称为policy1,序列号为1。
[DeviceA] ipsec policy policy1 1 isakmp
[DeviceA-ipsec-policy-isakmp-policy1-1] security acl 3000
[DeviceA-ipsec-policy-isakmp-policy1-1] transform-set tran1 [DeviceA-ipsec-policy-isakmp-policy1-1] quit
#在GRE隧道接口上应用安全策略。
[DeviceA] interface tunnel 0
[DeviceA-Tunnel0] ipsec apply policy policy1
[DeviceA-Tunnel0] quit
4.4.2?Device B的配置
(1)配置各接口IP地址
#配置接口GigabitEthernet2/0/1的IP地址。
[DeviceB] interface gigabitethernet 2/0/1
[DeviceB-GigabitEthernet2/0/1] tcp mss 1350
[DeviceB-GigabitEthernet2/0/1] quit
#配置接口GigabitEthernet2/0/2的IP地址。
[DeviceB] interface gigabitethernet 2/0/2
[DeviceB-GigabitEthernet2/0/2] quit
(2)配置GRE隧道
#创建Tunnel0接口,并指定隧道模式为GRE over IPv4隧道。
[DeviceB] interface tunnel 0 mode gre
#配置Tunnel0接口的IP地址为。
#配置Tunnel0接口的源端地址为(Device B的
GigabitEthernet2/0/2的IP地址)。
#配置Tunnel0接口的目的端地址为(Device A的
GigabitEthernet2/0/2的IP地址)。
[DeviceB-Tunnel0] quit
#配置从DeviceB经过Tunnel0接口到Corporate network的静态路由。
(3)配置IPsec VPN
#配置IKE keychain。
[DeviceB] ike keychain keychain1
[DeviceB-ike-keychain-keychain1] quit
#创建ACL3000,定义需要IPsec保护的数据流。
[DeviceB] acl number 3000
[DeviceB-acl-adv-3000] quit
#配置IPsec安全提议。
[DeviceB] ipsec transform-set tran1
[DeviceB-ipsec-transform-set-tran1] esp encryption-algorithm des
[DeviceB-ipsec-transform-set-tran1] esp authentication-algorithm sha1
[DeviceB-ipsec-transform-set-tran1] quit
#创建一条IKE协商方式的IPsec安全策略,名称为policy1,序列号为1。
[DeviceB] ipsec policy policy1 1 isakmp
[DeviceB-ipsec-policy-isakmp-policy1-1] security acl 3000
[DeviceB-ipsec-policy-isakmp-policy1-1] transform-set tran1 [DeviceB-ipsec-policy-isakmp-policy1-1] quit
#在GRE隧道接口上应用安全策略。
[DeviceB] interface tunnel 0
[DeviceB-Tunnel0] ipsec apply policy policy1
[DeviceB-Tunnel0] quit
4.5?验证配置
#以Corporate network的主机向Remote office network的主机发起通信为例,从,会触发IPsec协商,建立IPsec隧道,在成功建立IPsec隧道后,可以ping通。
Request timed out.
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2ms, Average = 1ms
#在Device A上使用display ike sa命令,可以看到第一阶段的
SA正常建立。