Skip to content

通过知识获得解放,通过技术获得自由

Menu
  • 专题目录
  • 液压相关
    • 液压技术
    • 液压相邻技术
    • 液压应用
  • 计算机相关
    • 计算机和软件
    • 网络和网站技术
  • 哲学
  • 关于本站
Menu

winserver2016下部署ddns—dynv6的ipv6[0]

Posted on 2023年11月14日 by

运行环境winserver2016,也适用于win10 专业版

  • ddns注册

https://dynv6.com/

  • 部署过程

所有文件放在c:\dynv6中

dynv6.bat

@echo off
@set tempnum=
@set ipaddr=
@set oldipaddr=1.1.1.1
@set domain=xxxx.dynv6.net
@set token=xxxxxxz
@set IPV6_REGEX="\(\([0-9A-Fa-f]\{1,4\}:\)\{1,\}\)\(\([0-9A-Fa-f]\{1,4\}\)\{0,1\}\)\(\(:[0-9A-Fa-f]\{1,4\}\)\{1,\}\)"
@set IPV4_REGEX="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
@set URL="https://dynv6.com/api/update?hostname=%domain%&token=%token%&ipv4=%%ipaddr%%"
@set URLV6="https://dynv6.com/api/update?hostname=%domain%&token=%token%&ipv6=%%ipaddr%%&ipv6prefix=%%ipaddr%%"
@set BIN=C:\dynv6\wget -t 2 --prefer-family=IPv6 --no-dns-cache --no-check-certificate
 
rem ***ipv6***
for /F %%i in ('nslookup -qt^=AAAA %domain% ns1.dynv6.com ^|C:\dynv6\grep254 -m2 -o %IPV6_REGEX%') do ( set oldipaddr=%%i)
 
@echo Current %domain% IP Add:%oldipaddr%
 
:start_ip1
rem @cls
@echo ... 
@echo from ip.sb get ip address
@set ip6addr=null
 
REM ***ipv6***
for /F %%i in ('%BIN% -O- http://ip.sb  ^|C:\dynv6\grep254 -m 1 -o %IPV6_REGEX%') do (set ipaddr=%%i)
 
if "%ipaddr%" == "null" (
echo no ipv6 address
C:\dynv6\sleep 5
goto start_ip2
) else (
echo get ip address :%ipaddr%, old ip address:%oldipaddr%
if NOT "%oldipaddr%" == "%ipaddr%" (
echo ---renew IP---
goto update_web_ip
) else (
echo IP no change
rem C:\dynv6\sleep 180
exit
goto start_ip2
))
 
:start_ip2
@ipconfig /flushdns
@echo ...
echo From checkip.dyndns.com get ip
@set ipaddr=null
 
REM ***ipv4***
rem for /F %%i in ('%BIN% -O- http://checkip.dyndns.com ^|grep254 -m 1 -o %IPV4_REGEX%') do (set ipaddr=%%i)
REM ***ipv6***
for /F %%i in ('%BIN% -O- http://checkipv6.dyndns.com ^|C:\dynv6\grep254 -m 1 -o %IPV6_REGEX%') do (set ipaddr=%%i)
 
if "%ipaddr%" == "null" (
echo NO IP address
c:\dynv6\sleep 5
goto start_ip1
) else (
echo get newe IP address:%ipaddr%, old IP address:%oldipaddr%
if NOT "%oldipaddr%" == "%ipaddr%" (
echo ---renew IP---
goto update_web_ip
) else (
echo IP No Change
rem C:\dynv6\sleep 180
exit
goto start_ip2

))
 
 
:update_web_ip
@echo ==============================================
@echo ipaddr="%ipaddr%"
@echo ==============================================
@set var=null
 
REM ***ipv4***
rem for /F "tokens=*" %%i in ('%BIN% -O- %URL%') do (set var=%%i)
REM ***ipv6***
for /F "tokens=*" %%i in ('%BIN% -O- %URLV6%') do (set var=%%i)
 
echo renew=%var%
if "%var%" == "addresses updated" goto end
echo renew fail
rem C:\dynv6\sleep 120
exit

goto start_ip2

 
:end
set oldipaddr=%ipaddr%
echo renew sucess
rem C:\dynv6\sleep 300
exit
goto start_ip2

 

单次启动测试运行,dynv6.bat

在客户端测试

nslookup -qt=AAAA xxxx.dynv6.net

测试通过后,部署win下的定时任务

  • 设置定时任务

  • 效果

本地有ipv6的情况下,通过域名访问RDP,测试通过

 

参考资料:

  1. https://blog.csdn.net/jiuweiljp/article/details/117636846
  2. https://blog.csdn.net/weixin_43593122/article/details/95660085
  3. https://blog.csdn.net/langqingj/article/details/80974632

欢迎回来

希望本站对你有所帮助!

如有疑问请联系info@fanlog.org
2023 年 11 月
一二三四五六日
 12345
6789101112
13141516171819
20212223242526
27282930 
« 6 月    

AI辅助 (17)

© 2025 | Powered by Superbs Personal Blog theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT