Score:0

DNS Records: One IP for Primary Domain and One IP for Multiple Subdomain

jp flag

I'm using Cloudflare (no proxy) to manage DNS Records. I have two servers with IP:

  • 128.xxx.xxx.xxx
  • 174.xxx.xx.x

And these are the DNS Records that I have created:

Type Name Content
A example.com 128.xxx.xxx.xxx
CNAME sub1 example.com
CNAME sub2 example.com
CNAME sub3 example.com

Now, I want to point the main domain (example.com) to the new IP (174.xxx.xx.x), the subdomains (sub1, sub2, sub3) keep using 128.xxx.xxx.xxx.

I could of course change the DNS records for each subdomain to type A by pointing all subdomains to IP 128.xxx.xxx.xxx like this:

Type Name Content
A example.com 174.xxx.xx.x
A sub1.example.com 128.xxx.xxx.xxx
A sub2.example.com 128.xxx.xxx.xxx
A sub3.example.com 128.xxx.xxx.xxx

The problem is, I have a lot of subdomains and the number is growing, I don't want to manually write the IP for the subdomains, apart from many, I'm also worried that I will switch servers with different IP addresses later.

Is there any way to solve this problem?

I really appreciate any answer, thanks in advance.

Score:1
us flag

You could create an A record cname.example.com, with the 128.xxx.xxx.xxx IP address.

Then for each domain, you would have CNAME point to cname.example.com.

mangohost

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.