DNS CNAME Resolution - which IP would be returned?

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 12.34.56.78

ns1.an.example.com. 1800 IN A 123.45.67.1

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 123.45.67.1

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

pc1.an.example.com. 1800 IN A 123.45.67.2

pc2.an.example.com 1800 IN A 23.45.67.89 

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!


Solution 1:

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 123.45.67.2
  • 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 23.45.67.89 currently is.