Jack Wallen reveals you easy methods to flush the DNS cache in your Ubuntu Servers to keep away from DNS-released networking points.
Sometimes a community connection doesn’t appear to operate how we count on them to. And it doesn’t matter how a lot you troubleshoot the problem, the issue doesn’t go away. You’ve configured a static IP handle, that configuration is strong and you may ping your gateway, however one thing is inflicting that Linux server from reaching the skin world within the method you count on.
One downside may very well be the DNS cache. DNS is a vital side of networking for all machines, because it interprets names to IP addresses. When one thing goes improper with DNS, your machine may need hassle reaching the skin world. I’ve skilled, on a couple of events, a DNS cache to be the issue. When that occurs, what do you do? You flush the DNS cache.
This is an efficient process to undertake from time to time, as your DNS cache cannot solely develop too giant, nevertheless it might additionally include corrupt entries (which may trigger issues with connections). So, how do you flush the DNS cache on Ubuntu Server?
SEE: Hiring Kit: Network Engineer (TechRepublic Premium)
What you’ll want
The solely factor you’ll must flush the DNS cache in your Ubuntu Server is a person with sudo privileges. With that person on the prepared, let’s get to the flushing.
How to flush your DNS cache
Once upon a time, the DNS cache was flushed with a command like:
sudo systemd-resolve --flush-caches
The above command will nonetheless work on Ubuntu 20.04. But if you happen to’ve upgraded to Jammy Jellyfish (22.04), the method has modified. This new command is backward appropriate with 20.04.
First, let’s view the statistics of our DNS cache with the command:
You ought to see output much like this:
Current Transactions: 0
Total Transactions: 3520
Current Cache Size: 1
Cache Hits: 9
Cache Misses: 1388
To flush the cache, problem the command:
You ought to see the Cache Size entry reset to 0.
Believe it or not, that’s all there may be to flush a DNS cache in Ubuntu. This works for each Ubuntu Server and Ubuntu Desktop. If you’ve gone down a community troubleshooting rabbit gap and nothing appears to work, you may attempt flushing the DNS cache and see if that doesn’t resolve your downside.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the most recent tech recommendation for enterprise execs from Jack Wallen.