If you’re experiencing DNS resolution issues on a Linux system, there are several steps you can take to diagnose and check your upstream DNS resolver. Here’s a step-by-step guide:
Your DNS resolver settings are typically found in the
/etc/resolv.conf file. This file lists the DNS servers your system is using.
To check the file, you can use a command like
You should see output similar to this, which shows the DNS servers your system is using:
nameserver 220.127.116.11 nameserver 18.104.22.168
To test if your DNS is working, you can use the
nslookup commands followed by a domain name.
If these commands return an IP address, then your DNS is working.
You can also test querying specific DNS servers to rule out issues with your default resolver.
For example, to query Google’s public DNS for the IP of
dig @22.214.171.124 google.com
Sometimes, DNS issues can be caused by a firewall or network configuration that blocks DNS queries. You can check if you can reach the DNS server with
ping -c 3 126.96.36.199
188.8.131.52 with the DNS server you want to check.
If you’re using
systemd-resolved, which is common in newer distributions, you can check its status with:
systemctl status systemd-resolved
systemd-resolve on older systems) is a utility for service and network configuration. To check the status of the DNS servers, use:
This will show detailed information about the DNS servers and their reachability.
If you’re using Network Manager, it might be managing your DNS settings. You can check the settings with:
nmcli device show
Look for the
Sometimes, the logs can provide hints as to what’s going wrong with DNS. To check the logs, you can use:
journalctl -u systemd-resolved
systemd-resolved with the name of your DNS service if different.
If you think the issue might be related to caching, you can flush the DNS cache:
As a last resort, sometimes restarting the networking services can help:
sudo systemctl restart NetworkManager
Or, if you’re not using Network Manager:
sudo systemctl restart networking
If you have
sudo systemctl restart systemd-resolved
After performing these checks and actions, you should be able to identify if there’s an issue with your upstream DNS resolver or elsewhere in your system’s DNS configuration. If problems persist, it might be necessary to look at wider network issues or consult with your ISP or network administrator.