To host a website or application on your own VPS or dedicated server, your domain name must point to the public IP address of the server.
This is done using DNS records.
This guide explains how to point a domain to a Linux server using A and AAAA records and how to verify that the DNS configuration is working correctly.
Before You Start
You will need:
- A registered domain name
- Access to the domain’s DNS management
- A VPS or dedicated server
- The public IPv4 address of your server
- The IPv6 address if you want to use IPv6
For this example, we will use:
Domain: example.com
Server IPv4: 192.0.2.10
Replace these values with your actual domain and server IP address.
Step 1: Find Your Server IP Address
On your Linux server, run:
ip addr
For IPv4 only:
ip -4 addr
For IPv6:
ip -6 addr
Make sure you use the public IP address assigned to your server.
Step 2: Open Your DNS Management
Log in to the company where your DNS zone is managed.
This may be:
- Your domain registrar
- Your hosting provider
- A dedicated DNS provider
Open the DNS management or DNS zone section for your domain.
Step 3: Create an A Record
An A record points a hostname to an IPv4 address.
Create:
Type: A
Name: @
Value: 192.0.2.10
The @ normally represents the root domain.
This makes:
example.com
point to:
192.0.2.10
The exact DNS interface may differ between providers.
Step 4: Configure the www Subdomain
To make:
www.example.com
work, you can create another A record:
Type: A
Name: www
Value: 192.0.2.10
Alternatively, you can create a CNAME:
Type: CNAME
Name: www
Value: example.com
This makes www.example.com follow the DNS destination of example.com.
Step 5: Configure IPv6 with an AAAA Record
If your server has IPv6 connectivity, create an AAAA record.
For example:
Type: AAAA
Name: @
Value: 2001:db8::10
For www:
Type: AAAA
Name: www
Value: 2001:db8::10
Replace the example IPv6 address with the address assigned to your server.
Do not create an AAAA record unless your server has working IPv6 connectivity.
Step 6: Save the DNS Changes
Save the new records.
DNS changes are not always visible everywhere immediately.
The time required depends on factors such as:
- DNS provider
- TTL
- Previous cached records
- Resolver caching
Avoid repeatedly changing DNS records while waiting for a previous change to propagate.
Step 7: Check the A Record
From Linux, install DNS utilities if required:
sudo apt update
sudo apt install dnsutils -y
Then run:
dig example.com A
You can request a shorter result:
dig +short example.com A
You should see your server’s IPv4 address.
Step 8: Check the AAAA Record
For IPv6:
dig example.com AAAA
or:
dig +short example.com AAAA
If you have configured IPv6, the correct IPv6 address should appear.
Step 9: Check the www Record
Run:
dig +short www.example.com
Confirm that it resolves to the expected destination.
Step 10: Test DNS with Another Resolver
You can query a specific public DNS resolver.
For example:
dig @1.1.1.1 example.com
or:
dig @8.8.8.8 example.com
This can help determine whether a DNS change is visible outside your local resolver.
DNS Works but the Website Does Not
If the domain resolves to the correct server IP but the website does not load, the problem may no longer be DNS.
Check whether your web server is running.
For Nginx:
sudo systemctl status nginx
For Apache:
sudo systemctl status apache2
Check listening ports:
sudo ss -ltnp
Web servers normally use:
80 HTTP
443 HTTPS
Check the Firewall
If UFW is enabled:
sudo ufw status
Make sure the required HTTP and HTTPS ports are allowed.
For example:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Do not expose unnecessary ports.
DNS vs Web Server Configuration
DNS and web server configuration are separate.
DNS tells users:
example.com → SERVER-IP
Your web server then determines which website or application should respond when traffic reaches that server.
Pointing a domain to your server does not automatically configure Nginx, Apache or SSL.
Install SSL After DNS Is Working
Before requesting a Let’s Encrypt certificate, make sure your domain resolves correctly to your server.
Verify:
dig +short example.com
Once DNS is correct and your web server is configured, you can install a Let’s Encrypt SSL certificate using Certbot.
Common DNS Problems
Domain Points to the Wrong IP
Check:
dig +short example.com
If the returned IP is incorrect, review the A record in your DNS zone.
www Does Not Work
Check:
dig +short www.example.com
Make sure you have created an A, AAAA or CNAME record for www.
IPv4 Works but IPv6 Does Not
Check:
dig +short example.com AAAA
If an AAAA record exists but the server does not have working IPv6 connectivity, some visitors may experience connection problems.
Remove incorrect AAAA records or configure IPv6 correctly.
DNS Is Correct but Connection Is Refused
Check whether a service is listening:
sudo ss -ltnp | grep -E ':80|:443'
If nothing is listening, configure and start your web server.
Security Recommendation
Only point domains to servers that are properly configured and secured.
For public Linux servers:
- Keep the operating system updated
- Configure a firewall
- Secure SSH
- Enable HTTPS
- Disable unnecessary services
- Keep web server software updated
IDONCLOUD Server Infrastructure
IDONCLOUD provides VPS and Dedicated Server infrastructure for websites, applications and Linux workloads, with IPv4 and IPv6 connectivity.
Our Knowledge Base provides practical guides for DNS, Linux, networking and server administration.
Visit idoncloud.com to explore IDONCLOUD infrastructure.
Related Guides
- How to Install Let’s Encrypt SSL on Ubuntu with Certbot
- How to Install Nginx on Ubuntu
- How to Configure a Domain with Nginx
- How to Redirect HTTP to HTTPS
- How to Check Open Ports on a Linux Server
- How to Configure a Static IP Address on Ubuntu with Netplan