#!/bin/sh # Domain=domain1.jp MasterID=mydnsXXXXXX Password=xxxxxxxxxxx IfName=eth0 ipv4=0 ipv6=0 ip -o addr show | while read num ifname inet ipaddr other do test "$ifname" != "$IfName" && continue echo $other | grep "scope global" > /dev/null || continue echo $other | grep "mngtmpaddr" > /dev/null && continue case $inet in inet6) URL="https://ipv6.mydns.jp/directip.html?MID=${MasterID}&PWD=${Password}&IPV6ADDR=${ipaddr%/*}" if [ ${ipv6} -eq 0 ] then curl ${URL} -o /dev/null 1> /dev/null 2>&1 && ipv6=1 ans=`dig $Domain AAAA +short` logger -p user.info -t mydns "Status ifname=${ifname}, ${inet}=${ipaddr}, Ans=${ans}, Update=${ipv6}" fi ;; inet) URL="https://${MasterID}:${Password}@www.mydns.jp/login.html" if [ ${ipv4} -eq 0 ] then curl ${URL} -o /dev/null 1> /dev/null 2>&1 && ipv4=1 ans=`dig $Domain A +short` logger -p user.info -t mydns "Status ifname=${ifname}, ${inet}=${ipaddr}, Ans=${ans}, Update=${ipv4}" fi ;; esac done