Domain pointing to wrong IP address but DNS records seems correct

Solution 1:

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

Solution 2:

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.