什么是L2TP
L2TP是一种工业标准的Internet隧道协议,功能大致和PPTP协议类似,比如同样可以对网络数据流进行加密。不过也有不同之处,比如PPTP要求网络为IP网络,L2TP要求面向数据包的点对点连接;PPTP使用单一隧道,L2TP使用多隧道;L2TP提供包头压缩、隧道验证,而PPTP不支持。
如何搭建IPsec VPN
1.首先需要购买一个VPS服务器(必须要是linux的),我这里用的是VULTR的,操作系统装Ubuntu 和 Debian,或者CentOS.
2.使用一键部署脚本
Ubuntu and Debian.
wget https://git.io/vpnsetup -O vpnsetup.sh && sudo sh vpnsetup.sh
CentOS.
wget https://git.io/vpnsetup-centos -O vpnsetup.sh && sudo sh vpnsetup.sh
慢慢等待自动部署。
成功后的效果图:
将后面4项全部复制出来保存好Server IP:
IPsec PSK:
Username:
Password:
Windows设置VPN拨号
打开网络和Internet设置
➡VPN➡添加VPN连接
接下来在VPN提供商选择Windows内置
,VPN类型选择使用预共享密钥的L2TP/IPsec
,然后连接名称随便填,服务器名称或地址填VPS的IP,密钥:IPsec PSK:
,然后加上username
和password
.(就是上面保存的)。都填完后选择保存。
接下来在右下角找到连接就可以拨号VPN了
连接问题
第一次拨号可能会出现失败的情况,需要修改注册表解决
将下复制:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\RasMan\Parameters]
"ProhibitIpSec"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent]
"AssumeUDPEncapsulationContextOnSendRule"=dword:00000002
放到记事本,并将后缀改为.reg
管理员权限运行,再次进行拨号就可拨上了