Update DNS zone

Hi, i’m not shure to be right in this category.

My problem is, i will update an DNS zone at my dns provider by an automation. But i have some problems:

Currently i defined the following command in my configuration.yaml:

rest_command:
  update_dnsprovider:
    url: https://api.dnsprovider.net/api/call.cgi?s_login=USERNAME&s_pw=PASSWORD&command=UpdateDNSZone&dnszone=xxxxxxx.eu.&delrr0=ha 10 IN A 156.10.10.1&addrr0=ha 10 IN A 10.0.0.2&incserial=1

This command works great, BUT:

1: the current ip address in the command above (10.0.0.2) has to be replaced with the ip address stored in my HA sensor “myip”. How can i do that in a URL?

2: the old ip address has to be deleted first, before i can overwrite the dns zone with the new ip address. So how can i replace the ip address above (156.10.10.1). So i need also the ip address stored before the sensor myip get an update with the new ip address.

Very comlicated i know, but hopefully anyone can help.

Thanks

I’m curious, why do you do this?

Remote access ? If your local IP changes, you need to update the A record, similar to what duckdns does, but more reliable and your own domain.

Thats the reason, right :wink: