个人日记

1. 更新华为路由器GRE对端IP(使用3322的动态DNS)

发布时间:2014-11-05 09:28
文章类别:个人日记
原文地址:http://user.qzone.qq.com/582726866/blog/1415150886

 cd %~dp0
ping ns1.3322.net > ping.log
if %errorlevel% neq 0 exit /b -1
ping ns2.3322.net >> ping.log
if %errorlevel% neq 0 exit /b -1
set /p oldip=<oldip.txt
for /f “tokens=2” %%i in (‘nslookup  60go.f3322.org ns1.3322.net  2^>nul ^| findstr /n . ^| findstr “5:”‘) do set newip=%%i
if not “%newip%”==”%oldip%” (
 echo %newip%>newip.txt
 putty -ssh -l user -pw pass 192.168.4.1 -startup lua
 echo %newip%>oldip.txt
 exit /b 1
) else (
 for /f “tokens=2” %%i in (‘nslookup  60go.f3322.org ns2.3322.net  2^>nul ^| findstr /n . ^| findstr “5:”‘) do set newip=%%i
 if not “%newip%”==”%oldip%” (
  echo %newip%>newip.txt
  putty -ssh -l user -pw pass pass 192.168.4.1 -startup lua
  echo %newip%>oldip.txt
  exit /b 1
  )
 exit /b 0
)

标准