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

http://www.example.com points correctly to the IP address of the server where the site is hosted.

http://example.com (notice the lack of www) points to a different IP address.

The DNS records for the domain have no reference to this foreign IP address - what might be causing this?

share|improve this question

migrated from stackoverflow.com Dec 11 '09 at 18:04

This question came from our site for professional and enthusiast programmers.

add comment

4 Answers

As most of the replies have noted, you need an A record at the base of your domain-name pointing to the IP address of the web server.

However I would not recommend that www be a CNAME pointing at that base domain-name unless you understand exactly what you're doing.

Although this might seem simplest from a management point of view (only one record to change if your site changes IP address) it can have side effects.

Don't forget that a CNAME makes the left-hand-side (the "owner name" of the CNAME) equivalent to the right-hand-side for all DNS resource record types, and not just for A record queries.

So, if your zone looks like this:

$ORIGIN example.com
@       IN SOA ...
        IN NS ...
        IN NS ...
        IN A 192.0.2.1
        IN MX mail
        IN SPF ...
www     IN CNAME @

then a query for www.example.com IN MX? will return the same MX record as for example.com. Now if that's what you want, that's fine.

However it'll also do the same for the other records (SOA, NS, SPF, etc) which is not usually desired.

Hence the proper answer should be to just make www an A record too, with the same value as the base name:

$ORIGIN exmaple.com
@       IN A 192.0.2.1
wwww    IN A 192.0.2.1
share|improve this answer
add comment

Your main record for the host is always domainname.com (without the www). Mostly www is added as a CNAME (alias) record to your base A record for the domain.

So, look for the A record for example.com in your DNS records. Change that to the correct IP, and then add www as a CNAME record to point to your base record.

share|improve this answer
    
Bad idea for the reasons explained by Alnitak –  bortzmeyer Dec 17 '09 at 14:30
add comment

Keep in mind that DNS is hierarchical--different DNS servers can show different things if you've made recent changes that have yet to propagate.

Also, the plain domain name without the www is called the A record. Your domain should absolutely have one of these.

The other things (like WWW) is a CName.

Have you made any recent changes to the domain? If so, check the TTL (time to live) to see how long it takes for them to propagate. Also, make sure you are querying the authoritative DNS server.

share|improve this answer
add comment

First thing to do is to ping the addresses to see if the issue is caused by DNS or by a redirect on your website:

ping www.example.com & example.com. If they both go to the same place, then the issue is with your web server configuration. If they go to different places then it's your DNS.

The DNS settings can take time to propagate, and this is probably the issue. If the IP address for example.com has been wrong for a while, try and flush your DNS by changing it to a new & different IP address for a couple of days & then change it back.

re: Web server configuration. You'll need to look at any reverse proxy settings and redirects. If the web server is the issue, tell us what web server you use (Apache, IIS) and people will take it from there.

share|improve this answer
add comment

Your Answer

 
discard

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.