Servers & VPS

Configure Domain Dns On Vps Server

Learn how to point your domain to a VPS by correctly setting up A, CNAME, MX, and TTL records from your registrar's control panel.

Detailed image of illuminated server racks showcasing modern technology infrastructure.

To configure your domain DNS on a VPS, log into your domain registrar's panel, find the DNS zone, and create an A record pointing the root domain (and the www subdomain) to your server's public IP address.

It sounds simple — and at its core it is. But understanding what each record type does saves you hours of troubleshooting. This guide explains each piece clearly.

What Is DNS and Why Does It Matter for a VPS?

The Domain Name System (DNS) is the directory that translates a human-readable name like yourdomain.com into the numeric IP address that servers understand, such as 203.0.113.42.

With shared hosting, your provider configures DNS automatically. With a VPS, that responsibility falls on you. You have two main approaches:

  • Manage the DNS zone at the registrar: leave the registrar's nameservers (Namecheap, GoDaddy, Porkbun, etc.) in place and edit records from their panel. This is the simplest approach and the one this guide covers.
  • Run your own DNS server on the VPS (BIND9, PowerDNS): gives full control but adds operational complexity. Only worth it if you manage dozens of domains or need advanced configurations.

For most projects, managing the zone at the registrar is more than enough. Browse more VPS configuration resources if you want to go deeper on other server topics.

DNS Record Types You Need to Know

You don't need to memorize every record type that exists — these four cover 95% of cases for a typical website.

Record Purpose Example value
A Points a hostname to an IPv4 address 203.0.113.42
AAAA Points a hostname to an IPv6 address 2001:db8::1
CNAME Alias that points to another hostname www → yourdomain.com
MX Defines the inbound mail server mail.yourdomain.com (priority 10)
TXT Domain verification, SPF, DKIM, DMARC v=spf1 include:... ~all
TTL Time (seconds) resolvers cache the record 300 (5 min) or 3600 (1 hr)

Step by Step: Point Your Domain to the VPS

1. Get your VPS public IP

This is the address your provider gave you when the server was created. You can confirm it from the terminal with:

curl -s ifconfig.me

Write that IP down — you'll use it in every A record for this domain.

2. Open your registrar's DNS panel

Log in where you purchased the domain. Look for an option called "Manage DNS", "DNS Records", "Advanced DNS", or something similar.

3. Create the A record for the root domain

Add a new record with these values:

  • Type: A
  • Host / Name: @ (represents the root domain)
  • Value: your VPS public IP
  • TTL: 300 (for frequent changes) or 3600 (for stable setups)

4. Create the record for www

You have two equivalent options. The most common is a CNAME:

  • Type: CNAME
  • Host: www
  • Value: yourdomain.com (with a trailing dot in some panels: yourdomain.com.)

The alternative is a second A record with the same value as the root record. Both work; the CNAME is preferred because if you change the IP, you only update the root A record and the CNAME follows automatically.

5. Set up MX records (if you host email)

If you use Google Workspace, Zoho, or another external mail provider, they'll give you the exact MX values. If you're running your own mail server on the VPS:

  • Type: MX
  • Host: @
  • Value: mail.yourdomain.com
  • Priority: 10

You'll also need an A record for mail.yourdomain.com pointing to the VPS IP.

6. Add TXT records for secure email delivery

Without these records, your outgoing email will land in spam or be rejected outright:

  • SPF: v=spf1 ip4:203.0.113.42 ~all — authorizes your VPS as a valid sender.
  • DMARC: v=DMARC1; p=none; rua=mailto:[email protected] — email authentication policy.
  • DKIM: the public key generated by your mail server (Postfix/OpenDKIM). The value is generated by the server itself.

Verify That DNS Has Propagated Correctly

After saving changes, records can take anywhere from a few minutes to 48 hours to propagate globally, depending on the previous TTL. Useful verification tools:

  • Terminal: dig yourdomain.com A +short — returns the IP your local DNS provider already resolves.
  • whatsmydns.net: shows resolution from dozens of worldwide locations simultaneously.
  • nslookup: nslookup yourdomain.com 8.8.8.8 — queries Google's DNS servers directly to check propagation.

When dig returns your VPS IP, the site is reachable through the domain. If you've installed Apache or Nginx on the server, the page should load in your browser.

Common Mistakes and How to Avoid Them

  • Not deleting old A records: if the domain previously pointed to a different host, remove or update those records before adding new ones. Two conflicting A records produce unpredictable results.
  • CNAME on the root domain: the DNS standard doesn't allow a CNAME at @. Always use an A record (or ALIAS/ANAME if your registrar supports it) for the root domain.
  • TTL too high during testing: a TTL of 86400 (24 hours) means that if you make a mistake, you'll wait a full day for the fix to propagate. Use 300 while you're setting things up.
  • Forgetting the PTR record (reverse DNS): if you send email from the VPS, the PTR record (rDNS) must map from the IP back to the server's hostname. This is configured in your VPS provider's panel, not at the registrar.

If you need help setting up the full server stack or have questions about advanced DNS records, the team at elenlace.com provides specialized technical support for web projects in Mexico and Latin America.

Key Takeaways

  • The A record is the most important: it points your root domain to the VPS IP.
  • Use a CNAME for www pointing to the root domain, not a second independent A record.
  • Lower TTL to 300 seconds before making changes; raise it again once everything is stable.
  • If you use email, set up MX, SPF, DKIM, and DMARC from the start to avoid delivery issues.
  • Verify propagation with dig or whatsmydns.net before considering the setup complete.
  • Reverse DNS (PTR) is configured in the VPS provider's panel, not at the domain registrar.

FAQ

How long does DNS propagation take?

It depends on the TTL the record had previously. With a TTL of 3600 (1 hour), changes take up to 1 hour to be seen globally. With a TTL of 86400 (24 hours), it can take up to 48 hours. That's why it's smart to lower the TTL before making changes.

Do I need to install a DNS server on my VPS?

Not for most projects. Managing the DNS zone from your domain registrar is sufficient and much simpler. A self-hosted DNS server (BIND9, PowerDNS) is only worth the extra complexity if you manage many domains or need advanced configurations.

How do I know if my DNS is configured correctly?

Run dig yourdomain.com A +short from a terminal. If it returns your VPS IP, the A record has propagated correctly. To verify email, run dig yourdomain.com MX +short and confirm the right mail servers appear.

Can I use Cloudflare as a DNS manager instead of my registrar?

Yes, and it's highly recommended. Cloudflare offers free DNS management with a faster interface than most registrars, plus built-in DDoS protection and CDN. Just update your domain's nameservers to point to Cloudflare and manage all records from their dashboard.

Prefer it done for you? El Enlace handles hosting and professional web development.

Useful resources

Other providers and guides worth comparing:

← All