Nsupdate with empty A record

In order to mitigate the ongoing loss of records I wrote a Script which check for losses.
I want to use the API to recreate the domains. Sadly the v4 A Record gets lost. In order to recreate it I need to issue the update command with an empty A record so that the ip will be updated on update.

This seems not to be possible,

nsupdate <<EOF
server ns1.dynv6.com
zone example.com
update add v4.example.com 0 A
key hmac-sha1:[…]
send
EOF

which throws the error

could not read rdata
syntax error

Does anyone have a working example? is there a special string which needs to be used ?

Thanks in advance!

The code example in the official website documentation are just fine.
https://dynv6.com/docs/apis#dns-update
Delete first, then add.

I don’t think that you understand the problem. I never doubted that the example works.
Creating a new Record is not the problem. Creating a new record which is empty thus creating a dynamic record is the problem.

update add v4.example.com 0 A “here needs to be a valid ip”

but in order to create an A record which gets update on ip change this needs to be empty which is not possible with this code snippet.

Is there a special string or IP which needs to be used?

There is no point in creating an empty A record. If you don’t have an IP address, you don’t need a record. Why should a DNS server remember something like this? If you have a dynamic address, take the current one and update it when it changes.

Sure at a normal DNS Server an A Record without an IP makes not sense.
When I create an empty A Record here there will be created a dynamically updated record.

And yes at this point of time I update the IP via the script but I just want to know if it is possible to create a record at dynv6 with nsupdate which will be dynamically updated when the ipv4 changes.

Thanks

You don’t really understand ‘dynamic’. It means connecting an IP dynamically assigned by your ISP to a (sub) domain. If there is a change, it is passed on very quickly (TTL usually 1 to 5 minutes). But you are responsible for the update, because only you know when your ISP has assigned you a new IP. How is a DNS server supposed to determine that?

This is the dynv6 board, isn’t it? The whole purpose of this service is dynamic DNS. Why should I update the IP manually when this service does is automatically?

I honestly think that we are talking past each other.

Let me ask differently:
Is it possible to create an A Record with the “not set”-flag as in the first row in the picture below via nsupdate?

Best regards

I am very sorry, my mistake.

I didn’t think it was about an A entry for a subdomain. Although you can create an empty entry (not set) with dynv6, you can’t do that with nsupdate. nsupdate checks the parameters and does not allow an empty RDATA field.

I don’t think that can be done with standard tools. It’s a special ‘dynv6’ thing that this is possible. They probably replace the empty entry internally with the A entry of the main domain. I don’t know if there is another option besides the web interface.

I looked around and tried a bit. You can use the REST API for dynv6. There you can specify an empty string for the data field when adding a new record (or simply omit the field). This leads to the desired result.

FYI:

   curl -sS --fail \
   -H "Authorization: Bearer <YourToken>" \
   -H "Content-Type: application/json" \
   -H "Accept: application/json" \
   --data '{"name": "wantedsubdomain", "type": "A"}' \
   https://dynv6.com/api/v2/zones/<zoneID>/records

Replace <YourToken> with your HTTP token and <ZoneID> with your zone ID. You get your zone(s) and ID(s) with:

   curl -sS --fail \
   -H "Authorization: Bearer <YourToken>" \
   -H "Content-Type: application/json" \
   -H "Accept: application/json" \
   https://dynv6.com/api/v2/zones | jq