

1. 配置LNS
#
sysname LNS //给路由命名为LNS
#
l2tp enable //启用路由的L2TP功能
#
acl number 2001 //配置ACL,进行NAT转换使用,将L2TP分配的地址进行NAT
rule 5 permit source 192.168.1.0 0.0.0.255
#
ip pool lns //创建IP地址池,名称为lns,为接入用户分配IP地址
gateway-list 192.168.1.1
network 192.168.1.0 mask 255.255.255.0
#
aaa //配置L2TP拨入的用户名密码
authentication-scheme lmt
//创建一个名为lmt的认证方案, 可用undo authentication-scheme lmt来删除这个认证方案
domain huawei.com //创建一个名为huawie.com的域
authentication-scheme lmt //使huawie.com这个域的认证方案为lmt
local-user 123456789@huawei.com password cipher %^%#_<`.CO&(:LeS/$#F\H0Qv8B]KAZja3}3q'RNx;VI%^%#
//创建一个名为123456789@huawie.com的用户,并设置密码
local-user 123456789@huawei.com service-type ppp //设置这个用户的服务类型为ppp,使之可拔号
#
interface GigabitEthernet1/0/0
ip address 202.1.1.1 255.255.255.0
nat outbound 2001 //配置NAT功能,实现公网访问功能
#
interface Virtual-Template1 //创建VT虚拟接口模板,配置拨号参数
ppp authentication-mode chap domain huawei.com //配置认证方式时必须携带域名
remote address pool lns //远程地址址为上面创建的lns,也就是分配192.168.1.0这个网段给L2TP用户
ppp ipcp dns 10.10.10.10 //分配DNS网关,以便员工使用域名访问外网资源
ip address 192.168.1.1 255.255.255.0 //给Virtual-Template1这个接口分配网关和MAC
#
l2tp-group 1 //创建L2TP组,配置L2TP连接参数
undo tunnel authentication //PC拨入,建议使用不认证的方式
allow l2tp virtual-template 1
#
ip route-static 0.0.0.0 0.0.0.0 202.1.1.2 //这里是添加了一条静态路由
#
return
1. authentication-scheme命令详见
https://support.huawei.com/hedex/pages/EDOC1000163876DZG0814J/13/EDOC1000163876DZG0814J/13/resources/dc/authentication-scheme_aaa_view.html