I saw this example of a CNAME record, but I don‘t know what IP would be returned and couldn‘t find an answer.

I‘m looking for the IP of pc2.an.example.com and the mail server of an.example.com

Zone file example.com:

example.com. IN SOA...

example.com. 1800 IN NS ns1.example.com

an.example.com. 1800 IN NS ns1.an.example.com

ns1.example.com. 1800 IN A

ns1.an.example.com. 1800 IN A

Zone file an.example.com:

an.example.com. IN SOA...

an.example.com. IN NS ns1.an.example.com

ns1.an.example.com. 1800 IN A

an.example.com. MX 10 pc2.an.example.com

pc1.an.example.com. 1800 IN A

pc2.an.example.com 1800 IN A 

pc2 CNAME pc1.an.example.com.

So which IPs would be returned for pc2 and the mail server? My first idea was that the CNAME would be ignored because pc2 has an „A“ record with a full IP, but I noticed there is no dot at the end of pc2.an.example.com, maybe that has an effect because the adress is relative?

Thanks for any help!

  • MX records aren't supposed to point to CNAME records, although I don't think this is enforced widely. – Barmar Jul 17 '18 at 18:38

You'd get:

an.example.com. IN MX 10 pc2.an.example.com

pc2.an.example.com. IN CNAME pc1.an.example.com.
pc1.an.example.com. IN A
  • There can't exists another resourse record like A or AAAA with a CNAME. They'd get ignored.

  • pc2.an.example.com without a dot equals pc2.an.example.com.an.example.com. for which the IN A currently is.

  • Thanks for the answer! Just to clarify, the A record gets ignored and the CNAME record would be used (Got a bit confused with your second point)? – retrok Jul 17 '18 at 16:09
  • 1
    CNAME is specified that way: there should not be an A record and it can be considered an error, if there is. The name server should only return the CNAME and possibly additionally its A record. But you happen to not have a conflicting A record, because it's missing . and is actually something totally else. – Esa Jokinen Jul 17 '18 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.