link.bat

@echo off
CLS
color 17

if {%1}=={} goto noparms
if {%1}=={on} goto link
if {%1}=={off} goto unlink

:noparms
echo. =-=-=-=-=具体操作=-=-=-=-=
echo.
echo.
echo. 1 连接VPN
echo.
echo. 2 断开VPN
echo.
echo. 3 隐藏它
echo.
echo. 4 显示它
echo.
echo. 5 建立V(未实现)
echo.
echo. 6 退出
echo.

echo. 请输入你要操作的选项:
set /p X=
if "%X%"=="1" goto link
if "%X%"=="2" goto unlink
if "%X%"=="3" goto hidden
if "%X%"=="4" goto show
if "%X%"=="5" goto creat
if "%X%"=="6" goto exit

:endfun
if NOT "%X%"=="" goto noparms
goto exit

:link
echo. 请输入用户名
set /p u=
echo. 请输入密码
set /p p=
rasdial VPN %u% %p%
goto endfun

:unlink
rasdial VPN /DISCONNECT
goto endfun

:hidden

goto endfun

:show

goto endfun


:creat
rem 设置服务

sc config sharedaccess start=disabled
net stop SharedAccess
sc config remoteaccess start=auto
net start RemoteAccess
net start lanmanserver
net start RemoteRegistry

rem 开启VPN

netsh rasset administrator permit rem vpnuser改成已存在的某个账户,比如administrator
netsh ras ip add range172.18.118.170 10.10.10.10rem 设置地址池的范围,比如192.168.111.1 192.168.111.11
netsh ras ipset addrassignpool
netsh routing ip nat install
netsh routing ip nat add interface 本地连接 full rem”本地连接”可能是其他名称,最好先ipconfig确认下
netsh routing ip nat add interface 内部 private
netsh routing ip igmp install
netsh routing ip igmp add interface 内部 igmpprototype=IGMPRTRV3ifenabled=enable
robustvar=2startupquerycount=2startupqueryinterval=31genqueryinterval=125
genqueryresptime=10lastmemquerycount=2lastmemqueryinterval=1000accnonrtralertpkts=YES
netsh routing ip igmp add interface name=”本地连接”igmpprototype=IGMPPROXY ifenabled=enable

rem 隐藏日志

Windows Registry Editor Version5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RemoteAccess\Parameters]
"LoggingFlags"=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\Parameters]
"ProhibitIPsec"=dword:00000001
goto endfun


:exit

posted @ 2013-05-14 14:53  sovf  阅读(287)  评论(0编辑  收藏  举报