Code Monkey home page Code Monkey logo

Comments (17)

oznu avatar oznu commented on July 29, 2024 1

Good to see it working.

I'll catch the error at runtime and output / explain the fix in the container logs.

from docker-cloudflare-ddns.

oznu avatar oznu commented on July 29, 2024 1

Message shown if container is unable to get public ip in IPv6 mode:

----------------------------------------------------------------
ERROR: Failed To Get Public IPv6 Address
----------------------------------------------------------------
You must be running Docker with IPv6 support enabled or this
container with host networking enabled.

Add '--net=host' to your docker run command or if using
docker-compose add 'network_mode: host' to this service.
----------------------------------------------------------------

IPv4 Mode:

----------------------------------------------------------------
ERROR: Failed To Get Public IPv4 Address
----------------------------------------------------------------

from docker-cloudflare-ddns.

oznu avatar oznu commented on July 29, 2024

Hi,

Presently this only project only does IPv4.

Happy to accept a PR to add support for AAAA / IPv6 records. My network isn't setup for IPv6 at the moment so it's difficult test.

from docker-cloudflare-ddns.

jwillmer avatar jwillmer commented on July 29, 2024

I could test it for you. With DS-Lite you only get a shared IPv4 thats why it is a problem to use/set the IPv4 in cloudflare.

from docker-cloudflare-ddns.

jwillmer avatar jwillmer commented on July 29, 2024

Your script looks fairly easy, I see the fastest way for me is to replace the IPv4 lookup with IPv6 lookup and post the new IP to record AAA instead of A.
More work is needed to create a config to define if I like to update IPv4 or IPv6 or both.

from docker-cloudflare-ddns.

oznu avatar oznu commented on July 29, 2024

I don't think ipinfo.io supports IPv6 self-lookups, the dns record has no AAAA records as far as I can tell. So we will need an alternative http lookup method provider for that.

Can you see if this command works?

dig +short @resolver1.opendns.com myip.opendns.com AAAA

from docker-cloudflare-ddns.

oznu avatar oznu commented on July 29, 2024

Never mind, tested that command on a vps. It does not work.

from docker-cloudflare-ddns.

oznu avatar oznu commented on July 29, 2024

-e RRTYPE=A - Set to AAAA to use set IPv6 records instead of IPv4 records. Defaults to A for IPv4 records.

See https://github.com/oznu/docker-cloudflare-ddns#ipv6

The message there is very important:

You need to run docker with IPv6 support, or run the container with host networking enabled.

Running the container with host networking (on a host that can resolve IPv6 directly) is probably easier than enabling docker IPv6 support. To do this just add --net=host to your docker run command, or network_mode: host to your docker-compose.yml.

from docker-cloudflare-ddns.

jwillmer avatar jwillmer commented on July 29, 2024

wow, that was fast - very cool! For me this is all I need but I guess there are user with an IPv4 and an IPv6 that they want to refresh at the same time. I still close this issue since my use case works 👍

from docker-cloudflare-ddns.

oznu avatar oznu commented on July 29, 2024

I thought of adding both IPv4 and IPv6 support simultaneously, but that would require a bit more work to keep track of the AAAA and A record IDs at the same time.

A project for later :)

from docker-cloudflare-ddns.

jwillmer avatar jwillmer commented on July 29, 2024

The IPv6 is not fixed since your query provider does not support IPv6. You need to use a provide that returns you an IPv6 like:

curl --ipv6 https://myonlineportal.net/checkip
// curl --ipv4 https://myonlineportal.net/checkip

curl --ipv6 --url 'https://ipv6.nsupdate.info/myip'

from docker-cloudflare-ddns.

oznu avatar oznu commented on July 29, 2024

Both providers I added for IPv6 support IPv6:

# primary
curl -sf6 https://ifconfig.co

# backup
curl -sf6 https//diagnostic.opendns.com/myip

from docker-cloudflare-ddns.

jwillmer avatar jwillmer commented on July 29, 2024

I get the following error:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 30-cloudflare-setup: executing... 
DNS Zone: jwillmer.de (xxxx)
DNS Record: test.jwillmer.de (xxxx)
[cont-init.d] 30-cloudflare-setup: exited 0.
[cont-init.d] 50-ddns: executing... 
Updating CloudFlare DNS record test.jwillmer.de from 1234:de:1234:4567:baae:8910:1112:cc3 to ...
ERROR: Failed to update CloudFlare DNS record test.jwillmer.de from 1234:de:1234:4567:baae:8910:1112:cc3 to 
[cont-init.d] 50-ddns: exited 0.

docker-compose.yml

  cloudflare-ddns:
    image: oznu/cloudflare-ddns
    container_name: cloudflare-ddns
    restart: always
    environment:
      - EMAIL=xxxx
      - API_KEY=xxxx
      - ZONE=jwillmer.de
      - SUBDOMAIN=test
      - RRTYPE=AAAA

from docker-cloudflare-ddns.

oznu avatar oznu commented on July 29, 2024

Did you enable IPv6 on the docker daemon? Otherwise add network_mode: host to your docker-compose.yml:

#5 (comment)

from docker-cloudflare-ddns.

jwillmer avatar jwillmer commented on July 29, 2024

Works as intended 👍
Maybe you can add that info to Readme or create a demo docker-compose file?

from docker-cloudflare-ddns.

jwillmer avatar jwillmer commented on July 29, 2024

I noticed you did but it didn't stand out - sorry, my bad!

from docker-cloudflare-ddns.

jwillmer avatar jwillmer commented on July 29, 2024

Small note:

You must be running Docker with IPv6 support enabled or enable host networking on this container.

from docker-cloudflare-ddns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.