Troubleshooting DNS Resolution Issues on Linux Servers
When encountering ping: www.example.com: Name or service not known errors, follow these diagnostic steps:
-
Verify Network Interface Status Check active interfaces and their configurations:
ip addr showExample output showing a properly configured interface:
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 inet 192.168.1.100/24 brd 192.168.1.255 -
Test Basic Connectivity Confirm network layer functionality:
ping 1.1.1.1Successful pings indicate DNS-specific issues rather than general network problems.
-
Inspect DNS Configuration Examine resolver settings:
cat /etc/resolv.confValid configuration should include:
nameserver 9.9.9.9 nameserver 1.1.1.1 -
Validate Routing Table Check gateway configuration:
ip route showLook for default route entries:
default via 192.168.1.1 dev eth0 -
Restart Networking Services Aply configuration chenges:
sudo systemctl restart networking -
Verify Firewall Settings Check for DNS-related restrictions:
sudo iptables -L -n -vFor firewalld systems:
sudo firewall-cmd --list-services