diff --git a/usr/local/bin/dynv6 b/usr/local/bin/dynv6 index badaf49..17c9686 100644 --- a/usr/local/bin/dynv6 +++ b/usr/local/bin/dynv6 @@ -18,6 +18,7 @@ The following are at least required for the script to work: - DYNV6_HOSTNAME="" // the dynv6 hostname - DYNV6_IPV4_ENABLED=true // if should update ipv4 - DYNV6_IPV6_ENABLED=true // if should update ipv6 +- DYNV6_IPV6_INTERFACE=eth0 // which interface to track, be sure that Privacy Extensions are disabled You can copy this script to '/usr/local/bin' and use create a custom CONFIG_FILE as user. Examples can be found in '/usr/share/doc/'. EOF @@ -65,6 +66,9 @@ apply_defaults() { if [ -z ${DYNV6_IPV6_ENABLED} ]; then DYNV6_IPV6_ENABLED=true; fi + if [ -z ${DYNV6_IPV6_INTERFACE} ]; then + DYNV6_IPV6_INTERFACE="eth0"; + fi } check_required() { @@ -95,7 +99,7 @@ echo "Checking ${hostname}" # ipv6 if [ "${DYNV6_IPV6_ENABLED}" = "true" ]; then echo "Testing IPv6"; - ipv6Address=$(curl -s "https://v6.ident.me/") + ipv6Address=$(LC_ALL=C /usr/bin/ip -c=never -6 -o a s dev ${DYNV6_IPV6_INTERFACE} | grep --color=never -Po '(?<=inet6 )(2.*?)(?=\/64 scope global dynamic mngtmpaddr)') ipv6Res=$(curl -s -v "https://ipv6.dynv6.com/api/update?hostname=${hostname}&ipv6=${ipv6Address}&token=${token}") ipv6Changed=true; diff --git a/usr/share/doc/dynv6/.dynv6.conf.example b/usr/share/doc/dynv6/.dynv6.conf.example index c6ff9f9..fdf71c4 100644 --- a/usr/share/doc/dynv6/.dynv6.conf.example +++ b/usr/share/doc/dynv6/.dynv6.conf.example @@ -1,7 +1,8 @@ #!/usr/bin/env bash -DYNV6_MAIL_ENABLED="false" // if notify via mail -DYNV6_MAIL_ADDRESS="" // (optional) mail.rc has to be configured -DYNV6_TOKEN="" // the dynv6 token -DYNV6_HOSTNAME="" // the dynv6 hostname -DYNV6_IPV4_ENABLED=true // if should update ipv4 -DYNV6_IPV6_ENABLED=true // if should update ipv6 \ No newline at end of file +DYNV6_MAIL_ENABLED="false" # if notify via mail +DYNV6_MAIL_ADDRESS="" # (optional) mail.rc has to be configured +DYNV6_TOKEN="" # the dynv6 token +DYNV6_HOSTNAME="" # the dynv6 hostname +DYNV6_IPV4_ENABLED=true # if should update ipv4 +DYNV6_IPV6_ENABLED=true # if should update ipv6 +DYNV6_IPV6_INTERFACE=eth0 # which interface to track, be sure that Privacy Extensions are disabled \ No newline at end of file