From b72101de020306fb64b425da0dadd60cf35e719e Mon Sep 17 00:00:00 2001 From: Andrew Stowell Date: Fri, 8 Dec 2023 14:09:27 +0000 Subject: [PATCH] public ip v6 will start off try to use info from device list, like dynv6 does. --- 6-public-ip.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/6-public-ip.sh b/6-public-ip.sh index 84070ed..bf18a5b 100755 --- a/6-public-ip.sh +++ b/6-public-ip.sh @@ -3,8 +3,11 @@ # there are a few different ways to resolve public-ip, # keep trying until we get a result +# device info +address=$(ip -6 addr list scope global | grep -v " fd" | sed -n 's/.*inet6 \([0-9a-f:]\+\).*/\1/p' | head -n 1) + # dig -if [[ -n $(command -v "dig") ]]; then +if [[ -z "$address" ]] && [[ -n $(command -v "dig") ]]; then # via opendns address=$(dig "@resolver1.opendns.com" -6 "myip.opendns.com" "AAAA" "+short") if [[ "$?" -ne "0" ]]; then