文章目录
- 一、手动创建
-
- 1、修改注册表(修改后重启电脑!重启电脑!重启电脑!)
- 2、设置连接
- 3、设置连接
- 4、连接VPN——等待提示完成即可
- 二、自动连接
-
- 1、设置过程
- 2、复制出来并改名为rasphone1.pbk(其信息都是手动设置的信息)
- 3、双击rasphone1.pbk
- 4、点击属性——常规下更改ip
- 5、点击安全——在高级设置中更改密匙
- 6、点击连接——输入账号密码,域留空
- 7、点击连接登陆即可
- 三、一键操作脚本[参考二(3,4,5,6)]
-
- 1、将文件放在C盘VPN下
一、手动创建
1、修改注册表(修改后重启电脑!重启电脑!重启电脑!)
保存一下代码,重命名为L2tp.reg
链接:https://pan.baidu.com/s/1EHEsW2-18yQtCQwZwDEt4A
提取码:qfch
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\RasMan\Parameters]
"ProhibitIpSec"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent]
"AssumeUDPEncapsulationContextOnSendRule"=dword:00000002
2、设置连接
3、设置连接
4、连接VPN——等待提示完成即可
二、自动连接
1、设置过程
手动搭建后可以发现以下文件夹下创建了一个rasphone.pbk文件
%AppData%\Microsoft\Network\Connections\Pbk
2、复制出来并改名为rasphone1.pbk(其信息都是手动设置的信息)
用文本打开可看到其内容(ip114.114.114.114 账户test 密码123456 密匙123456789)
[VPN]
Encoding=1
PBVersion=6
Type=2
AutoLogon=0
UseRasCredentials=1
LowDateTime=570559312
HighDateTime=30819053
DialParamsUID=23743843
Guid=7A6DBFF57375BA4AAF17930610F88111
VpnStrategy=3
ExcludedProtocols=0
LcpExtensions=1
DataEncryption=8
SwCompression=0
NegotiateMultilinkAlways=0
SkipDoubleDialDialog=0
DialMode=0
OverridePref=15
RedialAttempts=3
RedialSeconds=60
IdleDisconnectSeconds=0
RedialOnLinkFailure=1
CallbackMode=0
CustomDialDll=
CustomDialFunc=
CustomRasDialDll=
ForceSecureCompartment=0
DisableIKENameEkuCheck=0
AuthenticateServer=0
ShareMsFilePrint=1
BindMsNetClient=1
SharedPhoneNumbers=0
GlobalDeviceSettings=0
PrerequisiteEntry=
PrerequisitePbk=
PreferredPort=VPN3-0
PreferredDevice=WAN Miniport (L2TP)
PreferredBps=0
PreferredHwFlow=1
PreferredProtocol=1
PreferredCompression=1
PreferredSpeaker=1
PreferredMdmProtocol=0
PreviewUserPw=1
PreviewDomain=1
PreviewPhoneNumber=0
ShowDialingProgress=1
ShowMonitorIconInTaskBar=0
CustomAuthKey=0
AuthRestrictions=552
IpPrioritizeRemote=1
IpInterfaceMetric=0
IpHeaderCompression=0
IpAddress=0.0.0.0
IpDnsAddress=0.0.0.0
IpDns2Address=0.0.0.0
IpWinsAddress=0.0.0.0
IpWins2Address=0.0.0.0
IpAssign=1
IpNameAssign=1
IpDnsFlags=0
IpNBTFlags=1
TcpWindowSize=0
UseFlags=2
IpSecFlags=1
IpDnsSuffix=
Ipv6Assign=1
Ipv6Address=::
Ipv6PrefixLength=0
Ipv6PrioritizeRemote=1
Ipv6InterfaceMetric=0
Ipv6NameAssign=1
Ipv6DnsAddress=::
Ipv6Dns2Address=::
Ipv6Prefix=0000000000000000
Ipv6InterfaceId=0000000000000000
DisableClassBasedDefaultRoute=0
DisableMobility=0
NetworkOutageTime=0
IDI=
IDR=
ImsConfig=0
IdiType=0
IdrType=0
ProvisionType=0
PreSharedKey=
CacheCredentials=1
NumCustomPolicy=0
NumEku=0
UseMachineRootCert=0
Disable_IKEv2_Fragmentation=0
PlumbIKEv2TSAsRoutes=0
NumServers=0
RouteVersion=1
NumRoutes=0
NumNrptRules=0
AutoTiggerCapable=0
NumAppIds=0
NumClassicAppIds=0
SecurityDescriptor=
ApnInfoProviderId=
ApnInfoUsername=
ApnInfoPassword=
ApnInfoAccessPoint=
ApnInfoAuthentication=1
ApnInfoCompression=0
DeviceComplianceEnabled=0
DeviceComplianceSsoEnabled=0
DeviceComplianceSsoEku=
DeviceComplianceSsoIssuer=
WebAuthEnabled=0
WebAuthClientId=
FlagsSet=0
Options=0
DisableDefaultDnsSuffixes=0
NumTrustedNetworks=0
NumDnsSearchSuffixes=0
PowershellCreatedProfile=0
ProxyFlags=0
ProxySettingsModified=0
ProvisioningAuthority=
AuthTypeOTP=0
GREKeyDefined=0
NumPerAppTrafficFilters=0
AlwaysOnCapable=0
DeviceTunnel=0
PrivateNetwork=0NETCOMPONENTS=
ms_msclient=1
ms_server=1MEDIA=rastapi
Port=VPN3-0
Device=WAN Miniport (L2TP)DEVICE=vpn
PhoneNumber=114.114.114.114
AreaCode=
CountryCode=0
CountryID=0
UseDialingRules=0
Comment=
FriendlyName=
LastSelectedPhone=0
PromoteAlternates=0
TryNextAlternateOnFail=1
3、双击rasphone1.pbk
4、点击属性——常规下更改ip
5、点击安全——在高级设置中更改密匙
6、点击连接——输入账号密码,域留空
7、点击连接登陆即可
三、一键操作脚本[参考二(3,4,5,6)]
1、将文件放在C盘VPN下
下载链接:
L2tp.reg
链接:https://pan.baidu.com/s/1EHEsW2-18yQtCQwZwDEt4A
提取码:qfch
rasphone1.pbk
链接:https://pan.baidu.com/s/1o_CXBUYmfaFrn-Akz430vQ
提取码:u9o6
VPN.bat
链接:https://pan.baidu.com/s/1nUED3tysb3wvb3KyhbdQVw
提取码:oypj
vpn.bat
@ECHO OFF&PUSHD %~DP0
setlocal EnableDelayedExpansion&color 3e & cd /d "%~dp0"
:WH
cls
echo.
echo VPN添加
echo.
echo --------------------------------------------------------------------------------
echo 0. 修改注册表
echo.
echo 1. 添加vpn连接
echo.
echo. --------------------------------------------------------------------------------set /p tsk="0-1:"
if not defined tsk goto:err
if %tsk%==0 goto:0
if %tsk%==1 goto:1
:err
goto:WH
:0
cls
start C:\VPN\l2tp.reg
pause
goto :WH
:1
cls
copy C:\VPN\rasphone1.pbk %AppData%\Microsoft\Network\Connections\Pbk
start %AppData%\Microsoft\Network\Connections\Pbk\rasphone1.pbk
echo 创建完成,按任意返回上一层!
pause
goto :WH