1、 神马VPN技术(L2TP) 精品文档 VPN技术(L2TP) VPN/VPDN介绍 VPN [Virtual Private Network] VPN,即虚拟私有网络/虚拟专网,是指在internet网络上通过一定的隧道技术来虚拟私有网络的技术;其技术/协议种类有非常多,典型的有GRE、L2TP、PPTP、IPSec、MPLS、SSH等;但从网络的组成结构来划分的话,可以分为3种:Access VPN、Intranet VPN、Extranet VPN。 VPDN [Virtual Private Dialup Network] VPDN,顾名思义,就是指
2、拨号性质的VPN网络。 常见的VPDN协议有L2TP、PPTP、L2F等等 L2TP介绍 l L2TP – Layer 2 Tunnel Protocol L2TP协议是由IETF起草,Microsoft、Ascend、Cisco、3COM等公司参予制定的二层隧道协议,它结合了PPTP和L2F两种二层隧道协议的优点,为众多公司所接受,已经成为IETF有关2层通道协议的工业标准。 L2TP网络构成 LNS – L2TP Network Server LAC – L2TP Access Concentrator Client LNS为L2TP服务器,该服务器完成对client的
3、最终授权和验证,接收来自LAC的隧道和连接请求,并建立连接LNS和用户的PPP通道。 LAC为L2TP的接入设备,它提供各种用户接入的AAA服务,发起隧道和会话连接的功能,以及对VPN用户的代理认证功能,它是ISP侧提供VPN服务的接入设备. L2TP的应用模型 l Intranet VPN n L2TP的三要素:LNS、LAC、Client分别有三个独立的主机设备担当,各自完成不同的任务。 n 最终LNS和LAC之间分别建立L2TP和PPP,对于Client来说,网络完全是透明的。 Client PC在访问远端服务器的时候,其发往LAC的IP数据包可以触发L2TP的相关连接;
4、LAC会分别向LNS发起PPP(包括提供认证信息)和L2TP(tunnel、session)的连接请求; LNS接收来自LAC的连接请求,并建立L2TP和PPP连接;同时完成授权和验证等操作 。 l Extranet VPN n LNS、LAC、Client同样分别有三个独立的主机设备担当,各自完成不同的任务。 n 但LNS和LAC建立L2TP;LNS和Client建立PPP,所以Client PC必须安装、设置相应的PPP内容,要有一个拨号过程。 Client PC在访问远端服务器的时候,通过设置相应的PPP内容,其上层业务数据经过PPP封装之后,先发往LAC,从而触发PPP连
5、接; LAC收到PPP之后,负责跟LNS建立一条L2TP隧道,随后将PPP内容中继到LNS上(包括ppp的交互和认证等信息); LNS接收来自LAC的连接请求,并建立L2TP;之后同Client建立PPP的相关连接,同时完成授权和验证等操作 。 l Access VPN n LAC和Client由一个主机来完成,通常是一个PC。 n PC client和LNS之间同时建立L2TP和PPTP的连接;用户需要分别设置L2TP和PPP的相关内容,使用时通常是一个“两次拨号”的过程。 Client PC通常需要安装L2TP的客户端软件(windows中一般有内置的,且一个软件中同时包含了L
6、2TP和PPP的相关内容),在访问远端服务器的时候,应用数据会直接触发PPP和L2TP;分别去向LNS建立连接 LNS在收到请求之后,会跟PC完成和维护L2TP中所有的相关内容 。 ★如果采用windows的L2TP客户端,需要注意一下,它内置的L2TP是跟IPSec捆绑在一起的。 –HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Rasman\Parameters –添加双字节值如下: –Value Name: ProhibitIpSec –Value: 1 L2TP相关调试 常用的L2TP调试指令集: show l
7、2tp tunnel show l2tp session debug l2tp event debug ppp negotiation L2TP配置示例 l Intranet VPN <192.168.0.0> LNS <10.0.0.0> LAC <192.168.1.0> 收集于网络,如有侵权请联系管理员删除 LNS配置: aaa authentication login default local aaa authentication enable default none aaa authentic
8、ation ppp default local username admin password admin username l2tp@ password 0 dcn interface Virtual-template0 ip address 172.16.0.1 255.255.0.0 ppp authentication chap ppp chap hostname l2tp@ peer default ip address 172.16.0.10 interface FastEthernet0/0 ip address 192.168.0.254 25
9、5.255.255.0 no ip directed-broadcast interface Ethernet2/0 ip address 10.0.0.1 255.0.0.0 no ip directed-broadcast ip route 192.168.1.0 255.255.255.0 172.16.0.10 vpdn enable vpdn-group 1 accept-dialin protocol l2tp local-name LNS port virtual-template 0 LAC配置(Intranet):
10、aaa authentication login default local aaa authentication enable default none aaa authentication ppp default local username admin password admin username l2tp@ password 0 dcn interface Virtual-tunnel0 ip address negotiated no ip directed-broadcast ppp chap hostname l2tp@ interface FastEt
11、hernet0/0 ip address 10.0.0.2 255.0.0.0 no ip directed-broadcast interface FastEthernet0/1 ip address 192.168.1.254 255.255.255.0 no ip directed-broadcast ip route 192.168.0.0 255.255.255.0 Virtual-tunnel0 vpdn enable vpdn-group 1 request-dialin domain initiate-to ip 10.0.0.1 prio
12、rity 1
protocol l2tp
local-name LAC
关于配置的详细解释,见本文档的最后一页
l Extranet VPN
<192.168.0.0> LNS <10.0.0.0> LAC
13、dmin password admin username l2tp@ password 0 dcn interface Virtual-template0 ip address 172.16.0.1 255.255.0.0 ppp authentication chap ppp chap hostname l2tp@ peer default ip address pool 172.16.0.10 interface FastEthernet0/0 ip address 192.168.0.254 255.255.255.0 no ip directed-
14、broadcast interface Ethernet2/0 ip address 10.0.0.1 255.0.0.0 no ip directed-broadcast ip route 192.168.1.0 255.255.255.0 172.16.0.10 vpdn enable vpdn-group 1 accept-dialin protocol l2tp local-name LNS port virtual-template 0 LAC配置(Extranet): aaa authentication login default
15、 local aaa authentication enable default none aaa authentication ppp default local username admin password admin interface FastEthernet0/0 ip address 10.0.0.2 255.0.0.0 no ip directed-broadcast interface Serial0/2 physical-layer mode async //设置为异步模式 no ip address no ip directed-
16、broadcast ppp authentication chap ppp chap hostname l2tp@ physical-layer speed 57600 line dial //线路拨号 vpdn enable vpdn-group 1 request-dialin domain initiate-to ip 10.0.0.1 priority 1 protocol l2tp local-name LAC l Access模式 <192.168.0.0>
17、 LNS
18、72.16.0.1 255.255.0.0 ppp authentication chap ppp chap hostname l2tp@ peer default ip address pool L2POOL interface FastEthernet0/0 ip address 192.168.0.254 255.255.255.0 no ip directed-broadcast interface Ethernet2/0 ip address 10.0.0.1 255.0.0.0 no ip directed-broadcast ip ro
19、ute default *.*.*.* vpdn enable vpdn-group 1 accept-dialin protocol l2tp local-name LNS port virtual-template 0 LAC配置(Access): 以win2K/XP为例设置拨号。 L2TP配置示例详解 l Intranet VPN 第一步:配置AAA认证 config# aaa authentication login default local //开启console、telnet登陆认证 config# aaa auth
20、entication enable default none //关闭enbale密码 config# aaa authentication ppp default local //PPP认证必须开启 config# username admin password admin //定义本地登陆用户名密码 config# username l2tp@ password 0 dcn //定义L2TP认证用户名密码 第二步:配置接口IP地址 config# interface FastEthernet0/0 config_if# ip address 192
21、168.0.254 255.255.255.0 config# interface Ethernet2/0 config_if# ip address 10.0.0.1 255.0.0.0 第三步:配置L2TP服务器虚拟拨号模板 config# interface Virtual-template0 config_if# ip address 172.16.0.1 255.255.0. //ip Unnumber ××× config_if# ppp authentication chap //PPP使用CHAP认证 config_if# ppp c
22、hap hostname l2tp@ //CHAP认证用户名 config_if# peer default ip address 172.16.0.10 //分配客户端IP地址 第四步:配置VPDN组 config# vpdn enable //配置vpdn功能使能 config# vpdn-group 1 //创建vpdn组,组名1 config_vpdn_1# accept-dialin //配置本vpdn组为NS config_vpdn_1#protocol l2tp //配置隧道使用协议为l2tp config_vpdn_1#local-name LNS //配置本地主机名LNS config_vpdn_1#port virtual-template 0 //克隆配置的原端口为VT0 第五步:配置指向客户端私网的隧道路由 config#ip route 192.168.1.0 255.255.255.0 172.16.0.10 LAC配置思路和LNS同,请参考注释中的配置案例。






