ddns 免费 ipv6

dynv6

复制代码
#!/bin/bash
hostname="域名
device="网卡明"
token="dynv6 token"

file=$HOME/.dynv6.addr6
[ ! -e "$file" ] && touch "$file"

[ -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)


bin="curl -fsS";

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

echo $current
# send addresses to dynv6
# ipv4
$bin "http://dynv6.com/api/update?hostname=$hostname&ipv6=$current&token=$token"
# ipv4
#$bin "http://ipv4.dynv6.com/api/update?hostname=$hostname&ipv4=auto&token=$token"
相关推荐
饿了吃洗衣凝珠20 分钟前
shell循环
linux·运维·服务器
代码不停1 小时前
Linux基础知识
java·linux·数据库
东风微鸣2 小时前
Linux台式机也能指纹识别登录验证啦
linux·指纹
路溪非溪4 小时前
USB的基础知识总结
linux
女神下凡4 小时前
芯易选(143):晶视智能(CVITEK)_开发指南
linux·arm开发·stm32·单片机·嵌入式硬件
Hhy_11075 小时前
【Linux 进击之路 · 01】起航篇:从认识操作系统到XShell 远程连接、多叉树目录体系到高频基础指令全解析
linux·服务器·后端·学习
-梅7 小时前
linux网络(1)网络聊天室与网络计算器
linux·运维·服务器
陌上花开缓缓归以16 小时前
linux mkimage使用说明
linux
FlightYe17 小时前
音视频修炼之容器与协议(七):HTTP-MP4 / HTTP-FLV
linux·网络·网络协议·http·ffmpeg·音视频
jipinxiaofeihua17 小时前
(文章8) 05章-C++泛型编程(下)
linux·运维·网络