L2TP的配置
LAC设备是电脑上面的一个VPN客户端软件 SecoClient软件
LNS设备是ensp当中的USG5500设备 S1为S5700设备
第一步:基本配置
LNS设备配置(用USG5500设备模拟)
#
interface GigabitEthernet0/0/0
alias GE0/MGMT
ip address 212.1.1.1 255.255.255.0
service-manage enable
service-manage ping permit
#
interface GigabitEthernet0/0/1
ip address 192.168.1.1 255.255.255.0
service-manage enable
service-manage ping permit
#
firewall zone local
set priority 100
#
firewall zone trust
set priority 85
add interface GigabitEthernet0/0/1
#
firewall zone untrust
set priority 5
add interface GigabitEthernet0/0/0
#
firewall zone dmz
set priority 50
#
[LNS]ip route-static 10.1.1.0 255.255.255.0 192.168.1.2
[LNS]firewall packet-filter default permit all ---放行所有安全策略
00:01:39 2020/02/28
Warning:Setting the default packet filtering to permit poses security risks. You
are advised to configure the security policy based on the actual data flows. Ar
e you sure you want to continue?[Y/N]y
S1设备的配置
#
vlan batch 10 20
#
interface Vlanif10
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif20
ip address 10.1.1.254 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#
ip route-static 172.16.123.0 255.255.255.0 192.168.1.1
#
测试一下LNS的内网服务器的连通
[LNS]ping 10.1.1.100
23:59:06 2020/02/27
PING 10.1.1.100: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.100: bytes=56 Sequence=1 ttl=127 time=260 ms
Reply from 10.1.1.100: bytes=56 Sequence=2 ttl=127 time=90 ms
Reply from 10.1.1.100: bytes=56 Sequence=3 ttl=127 time=220 ms
Reply from 10.1.1.100: bytes=56 Sequence=4 ttl=127 time=60 ms
Reply from 10.1.1.100: bytes=56 Sequence=5 ttl=127 time=150 ms
--- 10.1.1.100 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 60/156/260 ms
[LNS]
测试一下LNS的外网用户的连通
[LNS]ping 212.1.1.254
23:59:35 2020/02/27
PING 212.1.1.254: 56 data bytes, press CTRL_C to break
Reply from 212.1.1.254: bytes=56 Sequence=1 ttl=128 time=190 ms
Reply from 212.1.1.254: bytes=56 Sequence=2 ttl=128 time=110 ms
Reply from 212.1.1.254: bytes=56 Sequence=3 ttl=128 time=160 ms
Reply from 212.1.1.254: bytes=56 Sequence=4 ttl=128 time=50 ms
Reply from 212.1.1.254: bytes=56 Sequence=5 ttl=128 time=110 ms
--- 212.1.1.254 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/124/190 ms
[LNS]
第二步:在LNS设备上创建验证用户名和密码
配置本地用户名和密码,作为VPDN用户信息保存在设备中,用于验证接入的远程用户 配置本地用户类型,L2TP协议基于PPP协商,需要指定用户类型为ppp 用于为远程用户分配地址
#
aaa
local-user key password cipher Huawei@123
local-user key service-type ppp
ip pool 1 172.16.123.100 172.16.123.200
#
需要在S1设备上写到达172.16.123.0网段的静态路由
ip route-static 172.16.123.0 255.255.255.0 192.168.1.1
第三步:配置L2TP参数
全局使能L2TP功能 创建VT虚拟接口模板 配置PPP认证方式为chap
#
l2tp enable
#
interface Virtual-Template1
ppp authentication-mode chap
alias Virtual-Template1
ip address 1.1.1.1 255.255.255.0
remote address pool 1
#
需要将Virtual-Template1加入到安全区域当中
#
firewall zone untrust
set priority 5
add interface GigabitEthernet0/0/0
add interface Virtual-Template1
#
第四步:创建L2TP组
- 配置L2TP组作为LNS侧,响应LAC发起的连接请求
- 配置L2TP隧道的密码,需要和LNS保持一致。缺省情况下,L2TP使能了隧道认证功能,未配置隧道认证字
- 配置隧道名称,用于发起L2TP连接时,LNS根据LAC的隧道名称接入。缺省情况下,如果未指定隧道名称,则设备名称作为隧道名称
#
l2tp-group 1
allow l2tp virtual-template 1
tunnel password cipher 123456
tunnel name LNS
#
第五步:在外网用户进行测试
在华为官网上面下载SecoClient软件
在外网用户电脑ping公司内网服务器
在LNS设备的G0/0/0接口抓包和G0/0/1接口抓包