gstuartj / cf-ddns.sh

A simple client for automatically updating CloudFlare DNS with your current IP address
MIT License
81 stars 35 forks source link

Add options for interface name and A vs AAAA #2

Closed iiroj closed 7 years ago

iiroj commented 8 years ago

Hello,

it would be nice to be able to specify which interface name to get IP addresses from, and whether you want IPv4 or IPv6 (or both). For example:

I whipped up this script as a wrapper because cf-ddns.sh was getting an IPv6 address from the wrong interface (LAN) tried to update it to an A record:

#!/bin/sh

ip=`ip addr show eno1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1`
email=""
api_key=""
zone=""
record=""

sh /usr/local/cf-ddns.sh/cf-ddns.sh    \
  -w=$ip                               \
  -e=$email                            \
  -a=$api_key                          \
  -z=$zone                             \
  -r=$record
gstuartj commented 8 years ago

Just noticed this issue, thanks for submitting. Adding better ipv6 support via AAAA records is an excellent suggestion and will be next on my list. The wrapper script you wrote may be the best way to handle specifying an interface right now, but maybe something better can be done later. Right now I guess it relies on your default route for determining the public IP.