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"
相关推荐
shwill12332 分钟前
PID 算法(三)--- 增量 PID ↔ 单神经元 PID 等价映射
linux·算法
执笔画流年呀1 小时前
Linux搭建Java项目部署环境
java·linux·运维
Sisphusssss2 小时前
香橙派5plus GPIO
linux·python·ubuntu
W.W.H.2 小时前
嵌入式 Linux外接USB/WIFI模块兼容5G频段实战
linux·运维·5g·wifi
影视飓风TIM2 小时前
Linux下C程序编译:gcc 动态链接与静态链接全解
linux·c语言
小此方4 小时前
Linux网络(一):揭秘从网络发展哲学到 TCP/IP 协议栈分层设计的设计哲学
linux·网络·tcp/ip
星野爱8954 小时前
远程控制哪家安全性更高?ToDesk、UU远程、向日葵隐私屏深度测评!
linux·运维·网络
ALINX技术博客4 小时前
【黑金云课堂】FPGA技术教程Linux开发:系统定制
linux·运维·fpga开发
ShineWinsu5 小时前
对于Linux:传输层协议UDP原理的解析
linux·c++·面试·udp·协议·传输层·计算机系统
2601_965798476 小时前
How to Build a Custom Artisan Store on WordPress: Crafti Theme Review
linux·服务器·数据库