DNS Troubleshooting Guide for Linux
Identifying a DNS Issue
If you can reach an IP address on the internet but not the DNS hostname, it's likely a DNS issue. This means your network connection is working, but the DNS resolution is failing.Determining Your Current DNS Server
To find out which DNS server you are currently using, you can use the resolvectl command:
Code:
resolvectl status
Querying Hosts and DNS Servers
- Using nslookup
- To query a host:
Code:
nslookup example.com
- To query a host using a specific DNS server:
Code:
nslookup example.com 8.8.8.8
- To query a host:
- Using dig
- To query a host:
Code:
dig example.com
- To query a host using a specific DNS server:
Code:
dig @8.8.8.8 example.com
- To query a host:
- Using resolvectl
- To query a host:
Code:
resolvectl query example.com
- To query a host using a specific DNS server:
Code:
resolvectl query example.com 8.8.8.8
- To query a host:
Internal Private DNS Server vs. Public DNS Server
- Internal Private DNS Server: This is a DNS server within a private network, typically used to resolve hostnames for devices within the same network. It is not accessible from the public internet.
- Public DNS Server: This is a DNS server that is accessible from the public internet and can resolve hostnames for any domain. Examples include Google's DNS servers (8.8.8.8 and 8.8.4.4) and Cloudflare's DNS server (1.1.1.1).
Popular Public DNS Servers
- Google DNS: 8.8.8.8, 8.8.4.4
- Cloudflare DNS: 1.1.1.1, 1.0.0.1
- OpenDNS: 208.67.222.222, 208.67.220.220