cromefire / fritzbox-cloudflare-dyndns

Slim WAN IP updater for AVM FRITZ!Box devices, pushing updates towards Cloudflare DNS using push and poll strategies.
MIT License
33 stars 13 forks source link

Add support to address a local device via IPv6 #1

Closed cromefire closed 3 years ago

cromefire commented 3 years ago

Because port-forwading works differently for IPv6, this PR allows the app to construct the global IP of a device via the second half of it's IP (which is always the same if you configure it correctly) and the FRITZ!Box global IP. It then just puts that into cloudflare and this way you can access the device over IPv6.

cromefire commented 3 years ago

Sadly doesn't work

adrianrudnik commented 3 years ago

Hi, what was the problem?

cromefire commented 3 years ago

I thought this would work but it turns out the second half is different in the local address and the global address, so just combining them doesn't work

cromefire commented 3 years ago

I'm looking if I can pull the info from the API or so

adrianrudnik commented 3 years ago

Should be an endpoint for this, same way the UI get's the information I think. Not sure if I understand the outcome correctly.

There would be two port forwardings in the box that expose devices to the WAN side: NAS LAN::75ab => CloudFlare => WAN::75ab Fridge LAN::75ac => CloudFlare => WAN::75ab

Not that versed with IPv6 sadly

cromefire commented 3 years ago

As far as I understand it (and it seems to work), you have to portforward the part and address it's IPv6 directly if I enter it fritz box IPv6 I just get to the Fritz box login screen

cromefire commented 3 years ago

(I sadly can't find any API docs for the fritz box though)

adrianrudnik commented 3 years ago

I think it should be in one of the many TR-064 SOAP endpoints https://avm.de/service/schnittstellen/ if you really want to dig through that stuff ;)

cromefire commented 3 years ago

I'm coming to think it's easier to just add some second service the directly takes the IP address from the server for IPv6

cromefire commented 3 years ago

Okay so apparently I wasn't too wrong in my initial thought, but you need to use the IPv6 Prefix instead of using the IPv6 public address to calculate the global IP

cromefire commented 3 years ago

So I think I fixed it, but I'll have to try it

cromefire commented 3 years ago

So I finally got it working I hope there's no edge cases, but it should work for most/all people.

I also added Authentication via API Tokens

Please have a look if the Authentication is sufficient.

cromefire commented 3 years ago

You also probably want to tag a release and push a tagged docker container, so you can specify a specify release for the contaner

adrianrudnik commented 3 years ago

Cool, thanks I hope to get it reviewed the coming week, will let it run a bit before merging :+1:

adrianrudnik commented 3 years ago

I've added you to the CONTRIBUTORS.md, hope that's fine for you. I'll trigger the docker hub build process and publish the image under adrianrudnik/fritzbox-cloudflare-dyndns:preview and let it run for while.

cromefire commented 3 years ago

Cool I hope it works alright, it shouldn't break anything existing, apart from the deprecation notice on the legacy key mechanism