Closed jwillmer closed 6 years ago
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.
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.
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.
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
Never mind, tested that command on a vps. It does not work.
-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.
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 👍
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 :)
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'
Both providers I added for IPv6 support IPv6:
# primary
curl -sf6 https://ifconfig.co
# backup
curl -sf6 https//diagnostic.opendns.com/myip
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
Did you enable IPv6 on the docker daemon? Otherwise add network_mode: host
to your docker-compose.yml:
https://github.com/oznu/docker-cloudflare-ddns/issues/5#issuecomment-392521600
Works as intended 👍 Maybe you can add that info to Readme or create a demo docker-compose file?
I noticed you did but it didn't stand out
- sorry, my bad!
Good to see it working.
I'll catch the error at runtime and output / explain the fix in the container logs.
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
----------------------------------------------------------------
Small note:
You must be running Docker with IPv6 support enabled or enable host networking on this container.
I have a DS-Lite (dual stack) connection so that the IPv4 can't be used since I can't open IPv4 ports. How can I configure that this docker image only updates the IPv6 record in cloudflare?