内容へ移動
Kijima's private wiki
TANSTAAFL!
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
PDF の出力
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
現在位置:
技術系メモ
»
Dynamic DNS
トレース:
•
Welcome to your new DokuWiki
dynamicdns
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== Dynamic DNS ====== ダイナミックDNSのIPアドレス通知スクリプト ===== cron設定 ===== <file update-ddns /etc/cron.d/update-ddns> 9,19,29,39,49,59 * * * * pi /usr/local/bin/update-mydns 1 * * * * pi /usr/local/bin/update-No-ip </file> ===== MyDNS.JP ===== <file update-mydns update-mydns> #!/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 </file> ===== No-IP ===== <file update-No-ip update-No-ip> #!/bin/sh # Domain="domain2.com" LoginID="XXXXXXXX" Password="xxxxxxxxxx" IfName="eth0" UA="User-Agent: ${LoginID} Update-No-ip/Raspbian GNU/Linux 10 (buster) ${Email}" 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://${LoginID}:${Password}@dynupdate.no-ip.com/nic/update?hostname=${Domain}" data="myipv6=${ipaddr%%/*}" if [ ${ipv6} -eq 0 ] then res=`curl -s -A "${UA}" "${url}" --data-urlencode "${data}" 2>&1 | head -n 1 | tr -d '\r'` && ipv6=1 ans=`dig $Domain AAAA +short` logger -p user.info -t No-ip "Status ifname=${ifname}, ${inet}=${ipaddr}, Ans=${ans}, Query=${ipv6}, Res='${res}'" fi ;; inet) url="https://${LoginID}:${Password}@dynupdate.no-ip.com/nic/update?hostname=${Domain}" if [ ${ipv4} -eq 0 ] then res=`curl -s -A "${UA}" "${url}" 2>&1 | head -n 1 | tr -d '\r'` && ipv4=1 ans=`dig $Domain A +short` logger -p user.info -t No-ip "Status ifname=${ifname}, ${inet}=${ipaddr}, Ans=${ans}, Query=${ipv4}, Res='${res}'" fi ;; esac done </file>
dynamicdns.txt
· 最終更新:
2023/06/29 12:03
by
Minoru Kijima
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
PDF の出力
文書の先頭へ