找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 14985|回复: 158

[k3] G大梅林386自定义dynv6 ipv6 DDNS 脚本 更新端口设置方法

 火.. [复制链接]
发表于 2021-7-5 20:46 | 显示全部楼层 |阅读模式
本帖最后由 infi450 于 2021-7-5 22:40 编辑

参考了
https://www.right.com.cn/forum/f ... ypeid%26typeid%3D15



https://www.right.com.cn/forum/thread-4112536-1-1.html

仅适用于IPV6,端口根据需要设置,脚本如下:(设置完不是即时生效的,要等一段时间)
1、首先梅林打开SSH。——以便winscp连接、修改上传脚本;
2、winscp连接到路由,定位到 /jffs/scripts/ ,然后直接右键“新建” 文件——
文件名:ddns-start
脚本代码:(注意红色部分替换成你的dynv6帐号相关信息),


#!/bin/sh -e
hostname=i****.dns.army
device=ppp0
token=dg88888888888888888888X
netmask=64


file=/jffs/scripts/.dynv6.addr6
[ -e $file ] && old=`cat $file`

if [ -z "$hostname" -o -z "$token" ]; then
  echo "Usage: token=<your-authentication-token> [netmask=64] $0 your-name.dynv6.net [device]"
  exit 1
fi

if [ -z "$netmask" ]; then
  netmask=128
fi

if [ -n "$device" ]; then
  device="dev $device"
fi
address=$(ip -6 addr list scope global $device | grep -v " fd" | sed -n 's/.*inet6 \([0-9a-f:]\+\).*/\1/p' | head -n 1)

if [ -e /usr/sbin/curl ]; then
  bin="curl -fsS"
elif [ -e /usr/sbin/wget ]; then
  bin="wget -O-"
else
  echo "neither curl nor wget found"
  exit 1
fi

if [ -z "$address" ]; then
  echo "no IPv6 address found"
  exit 1
fi

# address with netmask
current=$address/$netmask

#if [ "$old" = "$current" ]; then
#  echo "IPv6 address unchanged"
# exit
#fi

# send addresses to dynv6
$bin "http://dynv6.com/api/update?hostname=$hostname&ipv6=$current&token=$token"

# save current address
echo $current > $file

/sbin/ddns_custom_updated 1


ip6tables -I INPUT -i ppp0 -p tcp -m tcp --dport 8001 -j ACCEPT  

nohup /usr/sbin/socat TCP6-LISTEN:8001,reuseaddr,fork TCP4:192.168.*.1:80 >/dev/null 2>&1 &

#上面两行一组,端口号和内部IP地址自己设置,开几个端口设置几组

ip6tables -I INPUT -i ppp0 -p tcp -m tcp --dport 8007 -j ACCEPT

nohup /usr/sbin/socat TCP6-LISTEN:8007,reuseaddr,fork TCP4:192.168.*.*:80 >/dev/null 2>&1 &

#上面两行一组,端口号和内部IP地址自己设置,开几个端口设置几组

ip6tables -I INPUT -i ppp0 -p tcp -m tcp --dport 8008 -j ACCEPT

nohup /usr/sbin/socat TCP6-LISTEN:8008,reuseaddr,fork TCP4:192.168.*.*:8000 >/dev/null 2>&1 &
#上面两行一组,端口号和内部IP地址自己设置,开几个端口设置几组







我的恩山、我的无线 The best wifi forum is right here.
发表于 2021-7-5 20:54 | 显示全部楼层
看看看看,多谢多谢。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-5 21:04 | 显示全部楼层
谢谢楼主分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-5 21:21 | 显示全部楼层
666666666666666666666666
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-5 21:41 | 显示全部楼层
感谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-5 22:12 | 显示全部楼层
感谢分享。。。。。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-5 22:50 | 显示全部楼层
感谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-5 23:55 | 显示全部楼层
要看看啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-6 00:32 | 显示全部楼层
的水费电费水电费水电费水电费
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-6 06:08 | 显示全部楼层
大梅林386自定义dynv6 ipv6 DDNS 脚本 更新端口设置方法 [修改]
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-6 09:45 | 显示全部楼层
哦 什么东西 瞧瞧
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-6 13:38 | 显示全部楼层
我也折腾这个好久。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-6 13:49 | 显示全部楼层
感谢分享
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-6 22:05 | 显示全部楼层
。。。。。。。。。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2021-7-7 07:15 | 显示全部楼层
谢谢大佬分享!!!!!!!!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-20 08:21

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表