A domain name only becomes useful once its DNS records tell the world where your server lives. In this guide you will connect a domain to your VPS Linux Infrawire, add IPv4, IPv6 and www records, and check that everything resolves correctly.
📋 Prerequisites
- A VPS with a public IPv4 address (and optionally IPv6). From your client area you can find the IP and the root password of the VPS.
- A registered domain name (
example.com) and access to its DNS zone, at your registrar or at a DNS provider. digandnslookupon your workstation or on the VPS:
Bash# Ubuntu 24.04 / Debian 12 sudo apt update && sudo apt install -y dnsutils # AlmaLinux 9 / Rocky 9 sudo dnf install -y bind-utils
🧭 Understand the record types
| Type | Purpose | Example value |
|---|---|---|
| A | Name to IPv4 address | VPS_IP |
| AAAA | Name to IPv6 address | VPS_IPV6 |
| CNAME | Alias to another name | example.com. |
A CNAME cannot live on the bare domain (example.com, the apex) because it would conflict with the other records of the zone. Use A/AAAA there, and a CNAME for subdomains such as www.
✍️ Create the A and AAAA records
In the DNS zone editor of your registrar, add these records. The host field @ stands for the bare domain.
TEXTType Host Value TTL A @ VPS_IP 3600 AAAA @ VPS_IPV6 3600
Some interfaces want the full name (example.com.) instead of @. Keep the trailing dot only if the editor asks for a fully qualified name. If you do not use IPv6 yet, skip the AAAA record: a wrong AAAA is worse than none, because many clients try IPv6 first.
🔗 Add www with a CNAME
Make www follow the main name so you only change the IP in one place:
TEXTType Host Value TTL CNAME www example.com. 3600
Other subdomains work the same way. Use an A record when a subdomain must point to a different server (api to another IP, for instance).
⏱️ TTL and propagation
The TTL (time to live, in seconds) tells resolvers how long they may keep an answer in cache. A new record usually appears within minutes, but a change to an existing record stays invisible until the old TTL expires.
- Before a migration, lower the TTL to
300a day ahead, then change the IP. - After the change is stable, raise it back to
3600or more. - Full propagation is never instant: expect from a few minutes to a few hours.
✅ Verify with dig and nslookup
Ask your own resolver, then ask a public one to compare:
Bashdig +short example.com A dig +short example.com AAAA dig +short www.example.com CNAME # Query a specific public resolver dig @1.1.1.1 +short example.com A dig @8.8.8.8 +short example.com A # Ask the authoritative servers directly (no cache) dig +short NS example.com dig @NAMESERVER +short example.com A
The same check with nslookup:
Bashnslookup example.com nslookup -type=AAAA example.com nslookup www.example.com 1.1.1.1
The answer must equal VPS_IP. Then test the path to the server:
Bashping -c 3 example.com curl -I http://example.com
🔁 Reverse DNS (PTR)
Forward DNS turns a name into an IP. Reverse DNS (PTR record) does the opposite: it maps VPS_IP back to a hostname. It is not managed in your domain zone but by whoever owns the IP block, so ask your provider to set it. Mail servers rely on it heavily, so set it to the name you use to send mail, for example mail.example.com, and make sure that name has a matching A record.
Bashdig -x VPS_IP +short host VPS_IP
☁️ Special case: Cloudflare proxy
When a record is proxied (orange cloud), public DNS returns Cloudflare addresses, not VPS_IP. That is expected: dig will never show your server IP.
- Web traffic (80/443) goes through Cloudflare; other services such as SSH, mail or game servers do not.
- For anything that is not HTTP(S), create a record set to DNS only (grey cloud), for example
ssh.example.compointing toVPS_IP. - Mail records (
mail, MX targets) must always be DNS only. - Keep SSL mode on Full (strict) and install a valid certificate on the VPS, otherwise you get redirect loops or error 525.
🛠️ Troubleshooting
The old IP still shows up. The previous TTL has not expired. Query the authoritative server with dig @NAMESERVER to confirm the zone is right, then wait. Flush your local cache if needed:
Bashsudo resolvectl flush-caches
NXDOMAIN or no answer. The record sits in the wrong zone, the host name has a typo, or the domain uses other name servers than the ones you edited. Compare dig NS example.com with the name servers declared at your registrar.
The domain resolves but the site does not load. DNS is fine; the problem is the service. Check that a web server listens on the port and that the firewall allows it:
Bashsudo ss -tlnp | grep -E ':80|:443'
🎉 Your domain now points to your VPS: from here you can install a web server and issue a certificate.