补充在最前面:L2TP客户端在拨号以后,客户端和服务端的数据全部发往本地虚拟接口,客户端之间、客户端和服务端之间并非是常规意义上的二层直连。直到环境搭完以后我才发现这个之前从未关注过的问题,但写了这么多,又不想浪费,就当是一篇pfSense的L2TP教程放出来吧(虽然之前也写过)。
L2TP是一种点到多点的虚拟专网方案,由中心位置的服务端加上拨入客户端组成,借助这个方案,客户端可以接入服务端网络,访问被授权的资源,这也是L2TP最广泛的用途——提供安全的、可管理的远程的资源访问服务。
另外,网关设备作为客户端,拨号连接另一台网关设备里,也可以实现Lan-to-Lan的局域网互联。
服务端的配置非常简单:启用服务、配置服务认证方式、配置加密算法(本例使用MS CHAP v2)、配置网络相关参数(地址池和网关等)、配置用户、配置用户可访问资源(部分设备需要设置,如果没有特殊的安全需求,可以考虑放行L2TP客户端访问所有局域网资源,pfSense以L2TP服务虚拟接口的防火墙策略的形式进行配置);此外还需要防火墙放行L2TP拨号端口UDP1701。




客户端配置
经典控制面板:网络和共享中心 -> 设置新的连接或网络 -> 连接到工作区 -> 创建新连接(使用Internet连接创建虚拟专用网络)。


Windows8/10中的现代“设置”界面:


另外,由于windows10的安全性设置,默认不允许低安全级别的L2TP拨号,需要修改注册表HKLM\SYSTEM\CurrentControlSet\Services\RasMan\Parameters下的两个键值:
- AllowL2TPWeakCrypto修改为1,允许弱安全连接;
- ProhibitIpSec修改为1(默认情况下没有,需要手工创建),即不使用IPSEC(Windows10只支持L2TP over IPSEC,所以服务端不支持IPSEC时,需要禁用Windows的L2TP IPSEC策略)。

拨号:


