OffshoreVps
TutorialsOct 13, 20266 min readBy the OffshoreVps team

How to Point a Domain to Your VPS: DNS Records Explained

A and AAAA records, CNAMEs, TTL and propagation, plus how to check that your domain really points at your server and the mistakes to avoid.

You bought a VPS and a domain. To make the domain open your server, you need DNS records. This guide explains the records that matter, how long changes take and how to check that it worked.

Terminal window on a VPS showing the commands used for pointing a domain to a VPS with DNS records, starting with “dig +short example.com”
The kind of commands you will run on your server in this guide.

The three records you need most

TypeNameValuePurpose
A@Your server's IPv4 addressPoints the bare domain (example.com)
AwwwYour server's IPv4 addressPoints www.example.com
AAAA@Your server's IPv6 addressOptional, only if the VPS has IPv6

A CNAME record makes one name an alias of another, for example www pointing at example.com. You cannot use a CNAME on the bare domain, which is why the root uses an A record.

Step by step

  1. Find your server's public IP address in your dashboard.
  2. Open the DNS settings for your domain. If you registered it with us, this is in the Domains section of your dashboard.
  3. Delete any old A records for the same names, such as parking pages.
  4. Add the A records from the table above.
  5. Save, then wait for the change to spread.

How long does DNS take?

Each record has a TTL (time to live) in seconds. Resolvers around the world cache the old answer until it expires. A TTL of 300 means about five minutes; 3600 means up to an hour. Lower the TTL a day before a planned move, then raise it again afterwards. New records on a name that never existed usually appear within minutes.

The steps of this guide in order: 1. The three records you need most; 2. Step by step; 3. How long does DNS take?; 4. Check that it worked; 5. Email records (if you send mail); 6. Frequent mistakes
The steps in this guide, in order.

Check that it worked

dig +short example.com
dig +short www.example.com
nslookup example.com 1.1.1.1

Both names should print your server's IP. If one still shows the old address, you are waiting on a cache. Querying a public resolver such as 1.1.1.1 or 8.8.8.8 avoids your own router's cache.

Email records (if you send mail)

  • MX tells the world where to deliver your mail.
  • SPF (a TXT record) lists the servers allowed to send for your domain.
  • DKIM (a TXT record) publishes the key used to sign your messages.
  • DMARC (a TXT record) tells receivers what to do with mail that fails the checks.

Frequent mistakes

  • Adding the record at the registrar while the domain uses other nameservers. DNS is edited wherever the nameservers point.
  • Typing the full domain in the Name field, which some panels turn into example.com.example.com.
  • Forgetting to set up the web server for the domain after DNS works. Pointing is only half the job; see our Nginx guide.