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"
相关推荐
Flash.kkl2 小时前
Linux——线程的同步和互斥
linux·开发语言·c++
sunfove2 小时前
Python 面向对象编程:从过程式思维到对象模型
linux·开发语言·python
云和数据.ChenGuang2 小时前
达梦数据库安装服务故障四
linux·服务器·数据库·达梦数据库·达梦数据
PPPPPaPeR.2 小时前
使用vim实现进度条(初级)
linux·编辑器·vim
纵有疾風起3 小时前
【Linux 系统开发】基础开发工具详解:自动化构建、版本控制与调试器开发实战
linux·服务器·开发语言·c++·经验分享·开源·bash
wtsolutions3 小时前
Advanced Features - Unlocking the Power of JSON to Excel Pro
linux·json·excel
Kratzdisteln3 小时前
【linux】
linux·运维·服务器
阿豪只会阿巴3 小时前
项目心得——发布者和订阅者问题解决思路
linux·开发语言·笔记·python·ubuntu·ros2
Elieal3 小时前
常用的 Linux 命令
linux·运维·服务器