Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

We have a zone with a 2 hour TTL. Previous to making any changes it returned an A record when looking up the entry for www.

We changed the entry for www to point to a CNAME record. After the change, we noticed that the host command was returning both a CNAME and an A record as shown:

user@osx:~$ host www.example.com
www.example.com has address
www.example.com is an alias for vip.example.com.
www.example.com is an alias for vip.example.com.

Was this a problem with some DNS servers caching? If we had simply let the TTL fully expire, would we have gotten a CNAME as expected with no A record?

I didn't get any more detailed information with dig or other commands.

EDIT: The true address for vip.example.com. is completely different from the A record that was originally returned:

user@osx:~$ host vip.example.com
vip.example.com has address
share|improve this question

4 Answers 4

up vote 1 down vote accepted

Does a dig +trace show anything? It should show how it comes to the response you're getting.

share|improve this answer
We have rolled back the change as this was affecting a production site. I did not run 'dig +trace' when I encountered this problem, but if I see the problems again, I shall run 'dig'. We plan to attempt this change again later today. –  Shane Meyers Feb 3 '10 at 20:47
+1 dig is a much better utility to use. Even just dig www.example.com will confirm for you what you are looking for. –  einstiien Feb 3 '10 at 20:57
The second attempt at changing DNS was successful. dig +trace and host both showed things functioning as expected. –  Shane Meyers Feb 5 '10 at 0:27

As far as I'm aware, this is perfectly normal. Querying a CNAME returns the value of the A record, because this is ultimately where it's mapping to, when you're querying for an A record.

Being a Windows guy, I use nslookup. When the query type is set to A I get:

Server:  bladedc1.live.local

Name:    example.com.au
Address:  x.x.x.x
Aliases:  www.example.com.au

But when I set the query type to CNAME I get:

Server:  bladedc1.live.local

Non-authoritative answer:
www.example.com.au        canonical name = example.com.au

example.com.au    internet address = x.x.x.x

Try setting the query type to CNAME instead of A and see what you get.

share|improve this answer
+1. AFAIK, this is correct. A DNS client will, as Farseeker has stated, return both the CNAME and A record as they're essentially "attached" to each other. When using CNAME records you ultimately only need to worry about the TTL of the A record as the CNAME record is simply an alias for the A record, and as such, is not going to change (unless you also change the CNAME record). –  joeqwerty Feb 3 '10 at 22:31
kechara# host cnametest.flame.org
cnametest.flame.org is an alias for www.isc.org.
www.isc.org has address
www.isc.org has IPv6 address 2001:4f8:0:2::d

Host is smart. It tries to display all the data it can to the user. However, dig is a much more reliable debugging tool.

share|improve this answer

You should first identify whether or not the response you are getting starts at the nameservers or is further down the chain.

$ host -t ns example.com
example.com name server b.iana-servers.net.
example.com name server a.iana-servers.net.
$ host example.com b.iana-servers.net
Using domain server:
Name: b.iana-servers.net

example.com has address
$ host example.com a.iana-servers.net.
Using domain server:
Name: a.iana-servers.net.

example.com has address
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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