Last active
June 21, 2022 22:15
-
-
Save pedrom34/0bfdf2bb7f2e17a8859c1fad7204d7bf to your computer and use it in GitHub Desktop.
Working (tested) asuswrt-merlin Custom DDNS script for OVH with Double NAT option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### | |
# Based on | |
# https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS#google-domains | |
# https://github.com/RMerl/asuswrt-merlin/wiki/Custom-DDNS#bind9-ddns-using-nsupdate | |
# | |
# Forked from | |
# https://gist.github.com/atais/9ea6595072096ab8077f619bd3648da8 | |
### | |
set -u | |
U=user | |
P=password | |
H=domain | |
# args: username password hostname ip | |
ovh_dns_update() { | |
CMD=$(curl -s -u $1:$2 "https://www.ovh.com/nic/update?system=dyndns&hostname=$3&myip=$4") | |
logger "ovh-ddns-updated: $CMD" | |
case "$CMD" in | |
good*|nochg*) /sbin/ddns_custom_updated 1 ;; | |
*) /sbin/ddns_custom_updated 0 ;; | |
esac | |
} | |
### When double NATed behind ISP's router this line gets IP from outside, otherwise, comment out next line. | |
IP=$(wget -O - -q http://myip.dnsomatic.com/) | |
# last parameter is IP, use $IP | |
ovh_dns_update $U $P $H $IP | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment