DNS
01
Point a Domain to Your Server
To associate a domain with your VPS, you need to add DNS records at your domain registrar (where you bought the domain) or with your DNS provider.
A Record (IPv4)
Create an A record pointing to your IP:
| Name | Type | Value | TTL |
|---|---|---|---|
@ | A | SERVER_IP | 3600 |
www | A | SERVER_IP | 3600 |
AAAA Record (IPv6)
If the server has an IPv6 address:
| Name | Type | Value | TTL |
|---|---|---|---|
@ | AAAA | IPv6_SERVER | 3600 |
CNAME Record (Alias)
To point a subdomain to another hostname:
| Name | Type | Value |
|---|---|---|
www | CNAME | example.com. |
02
DNS Propagation
After modifying DNS records, changes take time to propagate across the internet (from 15 minutes up to 48 hours). You can check the propagation status with:
- dnschecker.org
- whatsmydns.net
03
Verify DNS from the Server
bash
# Resolve a domain
nslookup example.com
# Detailed resolution
dig example.com
# Check MX record (email)
dig example.com MX
# Check which DNS server is being used
cat /etc/resolv.conf
04
Change Server DNS (Resolver)
Your server's DNS determines which servers it uses to resolve names. Edit /etc/resolv.conf:
nameserver 8.8.8.8
nameserver 1.1.1.1
On systems with systemd-resolved:
bash
# Edit the configuration file
nano /etc/systemd/resolved.conf
ini
[Resolve]
DNS=8.8.8.8 1.1.1.1
FallbackDNS=9.9.9.9
bash
systemctl restart systemd-resolved
05
Add a Local Hostname (/etc/hosts)
To map names to IPs without DNS (useful for local testing):
bash
nano /etc/hosts
Add:
192.168.1.100 my-server.local
06
Popular DNS Providers
| Provider | Primary | Secondary |
|---|---|---|
8.8.8.8 | 8.8.4.4 | |
| Cloudflare | 1.1.1.1 | 1.0.0.1 |
| Quad9 | 9.9.9.9 | 149.112.112.112 |
Gerelateerde artikelen
