maxisoft/Freenom-dns-updater

Round Robin DNS

Opened this issue · 2 comments

In the DNS settings on the Freenom website, I can set up round robin DNS by adding multiple records using the same hostname. For example, in domain example.tk, I can add hostname robin with IP 1.2.3.4, and save it, and I see robin in my list of records that I can modify. Then I add robin again at the bottom with IP 5.6.7.8, and once I save, I get two records, both named robin, one with type A and target 1.2.3.4 and the other with type A and target 5.6.7.8. If I query DNS for the domain robin.example.tk, I will see that it has two addresses, 1.2.3.4 and 5.6.7.8. Then running
fdu record ls example.tk
I will see something like
{'name': 'ROBIN', 'target': '1.2.3.4', 'ttl': 3600, 'type': 'A'},
{'name': 'ROBIN', 'target': '5.6.7.8', 'ttl': 3600, 'type': 'A'},

First of all, if it's possible from the Freenom API, I need a way to add yet another round robin record, e.g. a third record called robin with type A and target 9.10.11.12 using fdu rather than the website. Additionally, if the API supplies an index or unique ID of some sort for the record list, I need a way to change the target of the second robin record rather than the first or the third. For example, I would like to be able to specify something like
fdu record add example.tk -n robin[2] -t A -a 7.8.9.10 -l 3600 -u
which would keep the first robin record with target 1.2.3.4 and the third robin record with target 9.10.11.12 unchanged, but would change the second robin record, which had the IP 5.6.7.8 to IP 7.8.9.10. If something like this can already be done, I would need some documentation to explain exactly how this is implemented, as I was unable to find it either here on Github or in the fdu help system. Thanks.

Hello,

Thanks for this detailled issue.

For now freenom-dns-updater(fdu) does not handle round robin DNS.
I'm developping a solution for this but there's still an issue.

First of all, if it's possible from the Freenom API, I need a way to add yet another round robin record

Yes that's possible. The next update should bring a --round-robin flag with the fdu record add command.

a way to change the target of the second robin record rather than the first or the third

Yes but there's an issue.
Here's the issue :
let's say you have 3 ip for a record in that order: x.x.x.1, x.x.x.2, x.x.x.3
now you update the 2nd ip x.x.x.2 to x.x.x.5
then you have x.x.x.1, x.x.x.3, x.x.x.5 (in that order)
AND that's the problem : freenom sort the ips so the 2nd ip does not refer to x.x.x.5 but x.x.x.3

So the user and I cannot rely on the freenom round robin record's index for multiple update call.

As far as i know, freenom does not expose something like record id, record's creation date, ... which would be used to solve that problem.
There's others solutions like maintaining a custom ip order in a DB or a history of record changes but i think it's outside the scope of this program (and involve other problems).

That's said, next update should bring a --index option on fdu update and fdu delete commands to handle round robbin dns. And it'll be up to the user to double check the given index

Regards