配置分支机构与总部之间通过L2TP Over IPSec方式实现安全互通

组网需求

如图1所示,LAC为企业分支网关,LNS为企业总部网关,分支通过LAC自拨号的方式与总部建立L2TP隧道实现互通。

现企业希望通过L2TP隧道传输的业务进行安全保护,防止被窃取或篡改等。此时,可以配置L2TP over IPSec的方式来加密保护企业分支和总部的业务。

图1 配置分支机构与总部之间通过L2TP Over IPSec方式实现安全互通组网图

总公司ospf和分公司出口路由器的配置 分公司与总部网络连接_运维

配置思路

采用如下思路配置分支机构与总部之间通过L2TP Over IPSec方式实现安全互通:

  1. 配置接口的IP地址和到对端的静态路由,保证两端路由可达。
  2. 在LAC上配置L2TP功能,PPP用户通过L2TP隧道向总部发出接入请求,总部认证成功后建立隧道。
  3. 在LAC上配置到达LNS的路由,使能LAC的自拨号功能。
  4. 在LNS上配置L2TP功能及PPP用户,并配置访问公网的路由。
  5. 配置ACL,以定义需要IPSec保护的数据流。
  6. 配置IPSec安全提议,定义IPSec的保护方法。
  7. 配置IKE对等体,定义对等体间IKE协商时的属性。
  8. 配置安全策略,并引用ACL、IPSec安全提议和IKE对等体,确定对何种数据流采取何种保护方法。
  9. 在接口上应用安全策略组,使接口具有IPSec的保护功能。

操作步骤

  1. 配置接口的IP地址和到对端的静态路由
    # 在LAC上配置接口的IP地址。 <Huawei> system-view [Huawei] sysname LAC [LAC] interface gigabitethernet 1/0/0 [LAC-GigabitEthernet1/0/0] ip address 1.1.2.1 255.255.255.0 [LAC-GigabitEthernet1/0/0] quit [LAC] interface gigabitethernet 2/0/0 [LAC-GigabitEthernet2/0/0] ip address 10.1.10.1 255.255.255.0 [LAC-GigabitEthernet2/0/0] quit # 在LAC上配置公网路由实现和LNS路由可达。以静态路由为例,假设下一跳IP地址为1.1.2.2。 [LAC] ip route-static 1.1.1.1 255.255.255.0 1.1.2.2 # 在LNS上配置接口的IP地址。 <Huawei> system-view [Huawei] sysname LNS [LNS] interface gigabitEthernet 1/0/0 [LNS-GigabitEthernet1/0/0] ip address 1.1.1.1 255.255.255.0 [LNS-GigabitEthernet1/0/0] quit [LNS] interface gigabitEthernet 2/0/0 [LNS-GigabitEthernet2/0/0] ip address 10.1.2.1 255.255.255.0 [LNS-GigabitEthernet2/0/0] quit # 在LNS上配置公网路由实现和LAC路由可达。以静态路由为例,假设下一跳IP地址为1.1.1.2。 [LNS] ip route-static 1.1.2.1 255.255.255.0 1.1.1.2
  2. 配置L2TP
    # 在LAC上全局使能L2TP,并创建一个L2TP组并配置为用户名称为huawei的用户建立到达LNS的L2TP连接。 [LAC] l2tp enable [LAC] l2tp-group 1 [LAC-l2tp1] tunnel name lac [LAC-l2tp1] start l2tp ip 1.1.1.1 fullusername huawei # 在LAC上启用通道验证并设置通道验证密码。 [LAC-l2tp1] tunnel authentication [LAC-l2tp1] tunnel password cipher huawei [LAC-l2tp1] quit # 在LAC上配置虚拟PPP用户的用户名和密码,PPP认证方式以及IP地址。 [LAC] interface virtual-template 1 [LAC-Virtual-Template1] ppp chap user huawei [LAC-Virtual-Template1] ppp chap password cipher Huawei@1234 [LAC-Virtual-Template1] ip address ppp-negotiate [LAC-Virtual-Template1] quit # 在LAC上触发自拨号建立L2TP隧道。 [LAC] interface virtual-template 1 [LAC-Virtual-Template1] l2tp-auto-client enable [LAC-Virtual-Template1] quit # 在LAC上配置私网路由,使得企业分支用户与总部私网互通。 [LAC] ip route-static 10.1.2.0 255.255.255.0 virtual-template 1

    # 在LNS上配置LNS的AAA认证,用户名为huawei,密码为Huawei@1234。 [LNS] aaa [LNS-aaa] local-user huawei password Please configure the login password (8-128) It is recommended that the password consist of at least 2 types of characters, i ncluding lowercase letters, uppercase letters, numerals and special characters. Please enter password: Please confirm password: Info: Add a new user. Warning: The new user supports all access modes. The management user access mode s such as Telnet, SSH, FTP, HTTP, and Terminal have security risks. You are advi sed to configure the required access modes only. [LNS-aaa] local-user huawei service-type ppp [LNS-aaa] quit # 在LNS上配置LNS的IP地址池,为LAC的拨号接口分配IP地址。 [LNS] ip pool 1 [LNS-ip-pool-1] network 10.1.1.0 mask 24 [LNS-ip-pool-1] gateway-list 10.1.1.1 [LNS-ip-pool-1] quit # 在LNS上创建虚拟接口模板并配置PPP协商等参数。 [LNS] interface virtual-template 1 [LNS-Virtual-Template1] ppp authentication-mode chap [LNS-Virtual-Template1] remote address pool 1 [LNS-Virtual-Template1] ip address 10.1.1.1 255.255.255.0 [LNS-Virtual-Template1] quit # 在LNS上使能L2TP服务,创建一个L2TP组。 [LNS] l2tp enable [LNS] l2tp-group 1 # 在LNS上配置LNS本端隧道名称及指定LAC的隧道名称。 [LNS-l2tp1] tunnel name lns [LNS-l2tp1] allow l2tp virtual-template 1 remote lac # 在LNS上启用隧道认证功能并设置隧道认证字。 [LNS-l2tp1] tunnel authentication [LNS-l2tp1] tunnel password cipher huawei [LNS-l2tp1] quit # 在LNS上配置私网路由,使得企业总部与企业分支用户私网互通。 [LNS] ip route-static 10.1.10.0 255.255.255.0 virtual-template 1
  3. 配置ACL,定义各自要保护的数据流
    # 在LAC上配置ACL。 [LAC] acl number 3101 [LAC-acl-adv-3101] rule permit ip source 1.1.2.0 0.0.0.255 destination 1.1.1.0 0.0.0.255 [LAC-acl-adv-3101] quit # 在LNS上配置ACL。 [LNS] acl number 3101 [LNS-acl-adv-3101] rule permit ip source 1.1.1.0 0.0.0.255 destination 1.1.2.0 0.0.0.255 [LNS-acl-adv-3101] quit
  4. 创建IPSec安全提议
    # 在LAC上配置IPSec安全提议。 [LAC] ipsec proposal tran1 [LAC-ipsec-proposal-tran1] esp authentication-algorithm sha2-256 [LAC-ipsec-proposal-tran1] esp encryption-algorithm aes-128 [LAC-ipsec-proposal-tran1] quit # 在LNS上配置IPSec安全提议。 [LNS] ipsec proposal tran1 [LNS-ipsec-proposal-tran1] esp authentication-algorithm sha2-256 [LNS-ipsec-proposal-tran1] esp encryption-algorithm aes-128 [LNS-ipsec-proposal-tran1] quit
  5. 配置IKE对等体
    # 在LAC上配置IKE安全提议。 [LAC] ike proposal 5 [LAC-ike-proposal-5] encryption-algorithm aes-128 [LAC-ike-proposal-5] authentication-algorithm sha2-256 [LAC-ike-proposal-5] dh group14 [LAC-ike-proposal-5] quit # 在LAC上配置IKE对等体,并根据默认配置,配置预共享密钥和对端ID。 [LAC] ike peer spub [LAC-ike-peer-spub] undo version 2 [LAC-ike-peer-spub] ike-proposal 5 [LAC-ike-peer-spub] pre-shared-key cipher Huawei@1234 [LAC-ike-peer-spub] remote-address 1.1.1.1 [LAC-ike-peer-spub] quit # 在LNS上配置IKE安全提议。 [LNS] ike proposal 5 [LNS-ike-proposal-5] encryption-algorithm aes-128 [LNS-ike-proposal-5] authentication-algorithm sha2-256 [LNS-ike-proposal-5] dh group14 [LNS-ike-proposal-5] quit # 在LNS上配置IKE对等体,并根据默认配置,配置预共享密钥和对端ID。 [LNS] ike peer spua [LNS-ike-peer-spua] undo version 2 [LNS-ike-peer-spua] ike-proposal 5 [LNS-ike-peer-spua] pre-shared-key cipher Huawei@1234 [LNS-ike-peer-spua] remote-address 1.1.2.1 [LNS-ike-peer-spua] quit
  6. 创建安全策略
    # 在LAC上配置IKE动态协商方式安全策略。 [LAC] ipsec policy map1 10 isakmp [LAC-ipsec-policy-isakmp-map1-10] ike-peer spub [LAC-ipsec-policy-isakmp-map1-10] proposal tran1 [LAC-ipsec-policy-isakmp-map1-10] security acl 3101 [LAC-ipsec-policy-isakmp-map1-10] quit # 在LNS上配置IKE动态协商方式安全策略。 [LNS] ipsec policy use1 10 isakmp [LNS-ipsec-policy-isakmp-use1-10] ike-peer spua [LNS-ipsec-policy-isakmp-use1-10] proposal tran1 [LNS-ipsec-policy-isakmp-use1-10] security acl 3101 [LNS-ipsec-policy-isakmp-use1-10] quit
  7. 接口上应用各自的安全策略组,使接口具有IPSec的保护功能
    # 在LAC的接口上引用安全策略组。 [LAC] interface gigabitethernet 1/0/0 [LAC-GigabitEthernet1/0/0] ipsec policy map1 [LAC-GigabitEthernet1/0/0] quit # 在LNS的接口上引用安全策略组。 [LNS] interface gigabitethernet 1/0/0 [LNS-GigabitEthernet1/0/0] ipsec policy use1 [LNS-GigabitEthernet1/0/0] quit
  8. 检查配置结果
    # 配置成功后,在主机PC1执行ping操作仍然可以ping通主机PC2,它们之间的数据传输将被加密。执行display ipsec statistics命令可以查看数据包的统计信息。
    # 在LAC上执行display ike sa命令可以查看当前由IKE建立的安全联盟。 [LAC] display ike sa IKE SA information : Conn-ID Peer VPN Flag(s) Phase RemoteType RemoteID -------------------------------------------------------------------------------- 16 1.1.1.1:500 RD|ST v1:2 IP 1.1.1.1 14 1.1.1.1:500 RD|ST v1:1 IP 1.1.1.1 Number of IKE SA : 2 -------------------------------------------------------------------------------- Flag Description: RD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO--TIMEOUT HRT--HEARTBEAT LKG--LAST KNOWN GOOD SEQ NO. BCK--BACKED UP M--ACTIVE S--STANDBY A--ALONE NEG--NEGOTIATING # 在LAC或者LNS上执行display l2tp tunnel命令可看到L2TP隧道及会话建立,此处以LAC为例: [LAC] display l2tp tunnel Total tunnel : 1 LocalTID RemoteTID RemoteAddress Port Sessions RemoteName 1 1 1.1.1.1 1701 1 lns
  9. LAC的配置文件
  10. LNS的配置文件
#
 sysname LNS
#
 l2tp enable
#
acl number 3101
 rule 5 permit ip source 1.1.1.0 0.0.0.255 destination 1.1.2.0 0.0.0.255
#
ipsec proposal tran1
 esp authentication-algorithm sha2-256 
 esp encryption-algorithm aes-128 
#
ike proposal 5
 encryption-algorithm aes-128
 dh group14
 authentication-algorithm sha2-256
 authentication-method pre-share
 integrity-algorithm hmac-sha2-256
 prf hmac-sha2-256
#
ike peer spua
 undo version 2
 pre-shared-key cipher %^%#K{JG:rWVHPMnf;5\|,GW(Luq'qi8BT4nOj%5W5=)%^%#
 ike-proposal 5
 remote-address 1.1.2.1
#
ipsec policy use1 10 isakmp
 security acl 3101
 ike-peer spua
 proposal tran1
#
ip pool 1
 network 10.1.1.0 mask 255.255.255.0
 gateway-list 10.1.1.1
#
aaa
 local-user huawei password cipher $1a$_<`.CO&(:LeS/$#F\H0Qv8B]KAZja3}3q'RNx;VI$
 local-user huawei service-type ppp
#
interface Virtual-Template1
 ppp authentication-mode chap
 remote address pool 1
 ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet1/0/0
 ip address 1.1.1.1 255.255.255.0
 ipsec policy use1
#
interface GigabitEthernet2/0/0
 ip address 10.1.2.1 255.255.255.0
#
l2tp-group 1
 allow l2tp virtual-template 1 remote lac
 tunnel password cipher %@%@EB~j7Je>;@>uNr''D=J<]\WL%@%@
 tunnel name lns
#
ip route-static 1.1.2.1 255.255.255.0 1.1.1.2
ip route-static 10.1.10.0 255.255.255.0 Virtual-Template1
#
return
<span style="background-color:#dddddd">#
 sysname LAC
#
 l2tp enable
#
acl number 3101
 rule 5 permit ip source 1.1.2.0 0.0.0.255 destination 1.1.1.0 0.0.0.255
#
ipsec proposal tran1
 esp authentication-algorithm sha2-256 
 esp encryption-algorithm aes-128 
#
ike proposal 5
 encryption-algorithm aes-128
 dh group14
 authentication-algorithm sha2-256
 authentication-method pre-share
 integrity-algorithm hmac-sha2-256
 prf hmac-sha2-256
#
ike peer spub
 undo version 2
 pre-shared-key cipher %^%#JvZxR2g8c;a9~FPN~n'$7`DEV&=G(=Et02P/%\*!%^%#
 ike-proposal 5
 remote-address 1.1.1.1
#
ipsec policy map1 10 isakmp
 security acl 3101
 ike-peer spub
 proposal tran1
#
interface Virtual-Template1
 ppp chap user huawei
 ppp chap password cipher %@%@U>upTZ}mQM:rhRL:4;s$,(xf%@%@
 ip address ppp-negotiate
 l2tp-auto-client enable
#
interface GigabitEthernet1/0/0
 ip address 1.1.2.1 255.255.255.0
 ipsec policy map1
#
interface GigabitEthernet2/0/0
 ip address 10.1.10.1 255.255.255.0
#
l2tp-group 1
 tunnel password cipher %@%@/-#)Lg[S4F:#2~ZNvqa$]\DL%@%@
 tunnel name lac
 start l2tp ip 1.1.1.1 fullusername huawei
#
ip route-static 1.1.1.1 255.255.255.0 1.1.2.2
ip route-static 10.1.2.0 255.255.255.0 Virtual-Template1
#
return</span>