如何实现配置l2tp over ipsec VPN之后,限制终端只能通过l2tp over ipsec 方式拨入,不允许通过l2tp拨入
1、组网及说明
2、问题描述
实现配置l2tp over ipsec VPN之后,限制终端只能通过l2tp over ipsec 方式拨入,不允许通过l2tp拨入。
3、过程分析
在ipsec 策略中引用ACL 3001,匹配源端口为UDP1701的报文即可。不加此条ACL,通过l2tp或者l2tp over ipsec的方式都能拨入。
#
ipsec policy-template test 1
security acl 3001
transform-set 1 2 3 4 5 6
ike-profile 1
#
acl advanced 3001
rule 0 permit udp source-port eq 1701
#
下面以加了ACL之后l2tp无法拨入分析:
在IPsec安全策略中定义的ACL既可用于过滤接口入方向数据流,也可用于过滤接口出方向数据流,在入方向反向匹配ACL,所以只拨l2tp时目的端口为1701的报文可以反向匹配上acl 3001。
但是在入方向上,与ACL的permit规则匹配上的未被IPsec保护的报文将被丢弃,由于收到的报文是并未被ipsec保护L2TP报文,所以直接丢弃。
*Mar 6 17:32:17:130 2020 H3C IPSEC/7/ERROR:
Inbound IPsec processing: source address=192.168.66.1, destination address=192.168.66.254, protocol=17. Packet was dropped according to IPsec policy huqi(sequence number: 1).
*Mar 6 17:32:17:130 2020 H3C IPSEC/7/ERROR:
The reason of dropping packet is ACL check failed.
此时查看ACL的匹配数,与ipsec 丢弃的ACL检查不合格的数目也是一致。
dis acl all
Advanced IPv4 ACL 3001, 1 rule,
ACL"s step is 5
rule 0 permit udp source-port eq 1701 (2 times matched)
dis ipsec statistics
IPsec packet statistics:
Received/sent packets: 0/0
Received/sent bytes: 0/0
Dropped packets (received/sent): 2/0
Dropped packets statistics
No available SA: 0
Wrong SA: 0
Invalid length: 0
Authentication failure: 0
Encapsulation failure: 0
Decapsulation failure: 0
Replayed packets: 0
ACL check failure: 2 //入方向ACL检查失败,所以包被丢掉
MTU check failure: 0
Loopback limit exceeded: 0
Crypto speed limit exceeded: 0
由于拨l2tp over ipsce,是先建立ipsec,再通过ipsec隧道建立l2tp,在入方向上,目的地址为本机的被IPsec保护的报文将被进行解封装处理。缺省情况下解封装后的IP报文若能与ACL的permit规则匹配上则采取后续处理,否则被丢弃。(拨l2tp over psec时,入方向收到的是被ipsec保护的报文,且报文解封装之后能反向匹配上ACL,所以进行后续的处理。)
4、解决方法
要想实现配置l2tp over ipsec VPN之后,限制终端只能通过l2tp over ipsec 方式拨入,不允许通过l2tp拨入,就在ipsec策略中加上匹配源端口为UDP1701的安全流;要是想实现l2tp over ipsec 或者l2tp都能拨,那就不加此条安全流。