When something on a Linux system cannot reach the internet, DNS is often the real problem. DNS is the process that turns a name like google.com into an IP address that computers can actually use.
The good news is that DNS issues follow a predictable pattern. You do not need deep theory or advanced networking knowledge to fix them. You just need a calm, repeatable process.
This guide walks through that process step by step, using simple commands and clear checks, pulled directly from the original script .
Step 1: Confirm the Problem Is DNS
Before changing anything, confirm what is actually broken.
DNS resolution means converting a domain name into an IP address. If this step fails, many tools look broken even though the network itself is fine.
Command
ping google.com
Example Output (DNS failure)
ping: google.com: Temporary failure in name resolution
What This Means
This message tells you the system cannot resolve the name google.com.
This is not a browser issue.
This is not a website issue.
This points directly to DNS.
Why This Matters in IT
When users say “the internet is down,” this command helps you quickly determine whether DNS is the real issue before touching anything else.
Step 2: Verify Basic Network Connectivity
Next, check whether the system can reach the internet at all.
Instead of using a domain name, you ping an IP address directly.
Command
ping 8.8.8.8
Example Output (working network)
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=18 ms64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=17 ms
What This Means
The system can reach the internet.
The network is working.
Only name resolution is failing.
This confirms you are focusing on the correct problem.
Real-World Use
This is how you prove that the network is up and that DNS is the failure point, not the connection itself.
Step 3: Check Which DNS Servers Linux Is Using
Now you look at where Linux is trying to get DNS answers from.
Command
cat /etc/resolv.conf
Example Output
nameserver 127.0.0.53
What This Means
This file tells Linux where to send DNS requests.
127.0.0.53 means the system is using a local DNS service, usually called systemd-resolved. This is normal on many modern Linux systems.
Problems happen when this service is misconfigured or not receiving valid DNS servers.
Real-World Use
This file is one of the first places you check when debugging DNS on laptops, servers, or cloud systems.
Step 4: Make Sure the DNS Service Is Running
If the local DNS service is not running, name resolution will fail.
Command
systemctl status systemd-resolved
Example Output
Active: active (running)
What This Means
If the service is running, you move on.
If it is stopped or failed, DNS will not work until it is running again.
Real-World Use
This service often breaks after system updates or when virtual machines are cloned.
Step 5: View the Active DNS Configuration
Now ask the system what DNS servers it is actually using.
Command
resolvectl status
Example Output (simplified)
DNS Servers: 192.168.1.1
What This Means
This shows the real DNS server being used.
At home, this is often your router.
At work, this may be a domain controller or internal DNS server.
If this value is missing, incorrect, or unreachable, DNS will fail.
Real-World Use
This is how DNS issues are diagnosed on systems connected to VPNs or corporate networks.
Step 6: Test DNS Directly
Instead of using ping, you can test DNS resolution itself.
Command
resolvectl query google.com
Example Output
google.com: 142.250.72.14
What This Means
If this returns an IP address, DNS is working.
If it fails, DNS is still broken and needs to be fixed.
Step 7: Apply a Simple Temporary DNS Fix
Now you apply the simplest working fix.
You tell Linux to use known, reliable DNS servers.
Command
sudo resolvectl dns eth0 8.8.8.8 1.1.1.1
Replace eth0 with your actual network interface if needed.
What This Does
This configures the system to use Google and Cloudflare DNS servers.
This is safe for testing and learning.
Verify the Fix
resolvectl query google.com
If you see an IP address, DNS is now working.
Real-World Use
This is how you quickly restore internet access while you investigate the root cause.
Step 8: Confirm Everything Works
Finally, test name resolution again.
Command
ping google.com
Example Output
64 bytes from google.com: icmp_seq=1 ttl=117 time=18 ms
What This Means
DNS resolution is working.
The problem is fixed.
Common Beginner Mistakes to Avoid
Skipping IP Tests
Always test an IP address first.
Do not assume DNS is broken without confirming connectivity.
Editing /etc/resolv.conf Directly
Many systems overwrite this file automatically.
Changes may disappear after reboot.
Use resolvectl instead.
Trusting Router DNS Without Testing
Home routers and VPNs often provide unreliable DNS.
Testing with known servers helps isolate the issue.
A Practical IT Scenario
You are setting up a Linux server.
Package installs fail.
Web access fails.
SSH still works.
By testing IP connectivity first, you confirm the network is fine.
By checking DNS second, you fix the real problem in minutes instead of reinstalling the system.
This is practical, real-world Linux troubleshooting.
A Small Next Step
Once this process feels comfortable, the next step is learning how to set DNS permanently using NetworkManager so the fix survives reboots.
Conclusion
DNS problems feel confusing at first, but they follow the same pattern every time.
If you work through these steps slowly and carefully, DNS troubleshooting becomes predictable and calm.
Repeat the process a few times, and it will feel natural.