Guest User!

You are not Sophos Staff.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DynDNS and IPv6

Hi there!

Is it possible to update a freedns.afraid.org AAAA record with the IP of the UTM External interface?
If yes: How?


This thread was automatically locked due to age.
Parents
  • Well, with freedns.afraid.org it's quite easy as you can simply call an update URL:
    freedns.afraid.org/.../update.php&address=1111:2222::ffff


    So I wrote a little shell script which runs every 5 minutes (via cron) and checks if the registered IPv6 IP is the same as the newest one from UTM's WAN interface (eth1 in my case):
    #!/bin/sh
    #FreeDNS updater script

    INTERFACE=eth1
    UPDATEURLBASE="freedns.afraid.org/.../update.php&address="
    DOMAIN=""
    IPV6REGEX="((([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{7}(([0-9A-Fa-f]{1,4})|[[[[[[[[:)]]]]]]]])|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{6}(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{5}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{4}(:[0-9A-Fa-f]{1,4}){0,1}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{3}(:[0-9A-Fa-f]{1,4}){0,2}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{2}(:[0-9A-Fa-f]{1,4}){0,3}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]](:[0-9A-Fa-f]{1,4}){0,4}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|([[[[[[[:(]]]]]]]:[0-9A-Fa-f]{1,4}){0,5}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?"

    registered=$(nslookup -q=AAAA $DOMAIN|grep $DOMAIN|grep AAAA|egrep -i -o $IPV6REGEX)

    current=$(ip -f inet6 addr show $INTERFACE|egrep -i -o "inet6.*scope global dynamic"|egrep -i -o $IPV6REGEX)

    logger $0: "Running FreeDNS IPv6 Updater Script for hostname $DOMAIN..."
    logger $0: "Current IPv6 of interface $INTERFACE is $current"

    if [ "$current" != "$registered" ]; then
         logger $0: "This doesn't match the registered IPv6 address ($registered). Calling update URL..."
         updateurl=$UPDATEURLBASE$current
         wget -q -O /dev/null $updateurl
         logger $0: "Done."
    else
         logger $0: "This matches the registered IPv6 address. Doing nothing."
    fi


    Don't be scared by the very long RegEx expression, it is to check that only the IPv6 address is grep'ed and nothing else.

    So far this is working well. The future will show if I have to tweak my script further...
Reply
  • Well, with freedns.afraid.org it's quite easy as you can simply call an update URL:
    freedns.afraid.org/.../update.php&address=1111:2222::ffff


    So I wrote a little shell script which runs every 5 minutes (via cron) and checks if the registered IPv6 IP is the same as the newest one from UTM's WAN interface (eth1 in my case):
    #!/bin/sh
    #FreeDNS updater script

    INTERFACE=eth1
    UPDATEURLBASE="freedns.afraid.org/.../update.php&address="
    DOMAIN=""
    IPV6REGEX="((([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{7}(([0-9A-Fa-f]{1,4})|[[[[[[[[:)]]]]]]]])|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{6}(:|((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})|(:[0-9A-Fa-f]{1,4})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{5}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{4}(:[0-9A-Fa-f]{1,4}){0,1}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{3}(:[0-9A-Fa-f]{1,4}){0,2}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]]{2}(:[0-9A-Fa-f]{1,4}){0,3}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(([0-9A-Fa-f]{1,4}[[[[[[[[:)]]]]]]]](:[0-9A-Fa-f]{1,4}){0,4}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|([[[[[[[:(]]]]]]]:[0-9A-Fa-f]{1,4}){0,5}(([[[[[[[:(]]]]]]](25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})?)|((:[0-9A-Fa-f]{1,4}){1,2})))|(((25[0-5]|2[0-4]\d|[01]?\d{1,2})(\.(25[0-5]|2[0-4]\d|[01]?\d{1,2})){3})))(%.+)?"

    registered=$(nslookup -q=AAAA $DOMAIN|grep $DOMAIN|grep AAAA|egrep -i -o $IPV6REGEX)

    current=$(ip -f inet6 addr show $INTERFACE|egrep -i -o "inet6.*scope global dynamic"|egrep -i -o $IPV6REGEX)

    logger $0: "Running FreeDNS IPv6 Updater Script for hostname $DOMAIN..."
    logger $0: "Current IPv6 of interface $INTERFACE is $current"

    if [ "$current" != "$registered" ]; then
         logger $0: "This doesn't match the registered IPv6 address ($registered). Calling update URL..."
         updateurl=$UPDATEURLBASE$current
         wget -q -O /dev/null $updateurl
         logger $0: "Done."
    else
         logger $0: "This matches the registered IPv6 address. Doing nothing."
    fi


    Don't be scared by the very long RegEx expression, it is to check that only the IPv6 address is grep'ed and nothing else.

    So far this is working well. The future will show if I have to tweak my script further...
Children
No Data