Use hostname/domain instead of IP for A-record

id flag

I need to create a A-Record for a subdomain on server X to make it point to server Y, but the IP from server Y is changing from time to time.

Server Y also has a hostname / domain.

The A-record does just accept IPV4 Addresses.

Is there also a way to use the hostname / domain of server Y instead of the IP address somehow, or do I have to change the A-Record each day by hand?

I tried it with CNAME as suggested in the comment by user10489, but I get an error

Error: The DNS zone file is invalid. (Line 514: CNAME and other data)

enter image description here

user10489 avatar
nc flag
Sounds like an XY problem. Maybe you want to use CNAME instead of A.
Black avatar
id flag
I tried CNAME and I get `Error: The DNS zone file is invalid. (Line 514: CNAME and other data)`
user10489 avatar
nc flag
Please add excerpts from your zone file to your question. Unless the hostname in question is also used in an NS record, the CNAME should work but maybe you have the syntax wrong.
Black avatar
id flag
I added a screenshot
Brandon Xavier avatar
us flag
Just for kicks, try adding a `.` after the `.com` in your CNAME record. That should prevent the DNS server from trying to append the zone origin to it (i.e. ``)
cn flag

The error you got probably means you already have another record with that name ("CNAME and other data"). CNAME records can not coexist with any other ones on the same name.

Had you given real names, people could have helped you better.

And by definition, A record are for IPv4 address, and not anything else.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.