2

I have a CNAME record like this:

*.a        IN CNAME    example.com.

So, any address that ends with .a.example.com points to example.com (like www.a.example.com, x.y.z.a.example.com, etc).

I add this CNAME record:

ex1.a      IN CNAME    example.net.

Then the address ex1.a.example.com points to example.net, while all other address that ends with .a.example.com points to example.com.

I add another CNAME record:

www.b.a    IN CNAME    example.org.

So www.b.a.mydom.com points to example.org.

But there is a problem:
any other request to resolution domain that ends with .b.a.example.com is not solved. I can't understand.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
riofly
  • 131
  • 1
  • 5

1 Answers1

3

Your first record is mostly fine, though I would add an explicit TTL like this (using 30 minute TTL as an example):

*.a        1800    IN CNAME    example.com.

For the other records I would do the same. Notice that when you create a record for www.b.a like this:

www.b.a    1800    IN CNAME    example.org.

It will override the * matching for b.a. Thus this record will now be the only one you have under b.a. If you want more CNAMEs under b.a you simply have to define three more * matches like this:

b.a        1800    IN CNAME    example.org.
*.b.a      1800    IN CNAME    example.org.
*.www.b.a  1800    IN CNAME    example.org.

Depending on your exact needs you might not need all three.

kasperd
  • 30,455
  • 17
  • 76
  • 124
  • Why add an explicit TTL to those records? – Tommiie Aug 27 '18 at 08:22
  • 1
    @Tom Every now and then we have questions where the entire problem is that somebody created records with a high TTL which are now cached on DNS recursors outside of their control. In this question it isn't even possible to tell what the TTL of those records is or where it came from. To me that's enough to recommend being explicit about the TTL. – kasperd Aug 27 '18 at 11:04