preface
Use the following command to query DNS in Linux system
dig baidu.com @114.114.114.114
Or use the default DNS server to query
nslookup baidu.com
The following methods may not all work, but you can always find one that works
1.network-manager and networking
In some Linux operating systems, such as the specific version of Ubuntu, DNS is managed by network manager.
In these systems, you need to run the command:
sudo service network-manager restart
In other systems, you can use the following command:
sudo service networking restart
2.ubuntu
In Ubuntu 12.04, you can try the following command:
sudo kill -HUP $(pgrep dnsmasq)
In Ubuntu 16.04 and Debian 9, you can refresh DNS with the following command
sudo systemd-resolve --statistics
On Ubuntu 17.04 and later, use the following command:
sudo systemd-resolve --flush-caches
3 /etc/ resolv.conf
/etc/ resolv.conf This file stores the address of the DNS server. Directly modifying this file can only temporarily change the default DNS address and restore the settings after restart.
You can modify this file directly for temporary use
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
After modification, Ping or NSLOOKUP again will get the IP address from the new DNS server
for the method of permanent modification, see how do I add a DNS server via resolv.conf?
4.nscd
NSCD is a good DNS caching service. Use the following command to install it:
apt install nscd #debian ubuntu
If you have NSCD installed on your Linux system, you can use the following command to refresh DNS:
sudo /etc/init.d/nscd restart
Resources:
How do I clear the DNS cache?
flush DNS cache in Ubuntu
Read More:
- There was a temporary DNS error. Try refreshing the page.
- Win10 problem solving – there was a temporary DNS error. Try refreshing the page
- Event ID 407, 408 – when NAT is used as a DNS server
- DNS name does not exist
- Network Error (dns_unresolved_hostname) -postman
- After installation, Ubuntu encountered [SDB] asking for cache data failed assembling drive cache: write through
- fiddler dns lookup for failed System.Net.Sockets The name of the. Socketexception request
- When installing software in Ubuntu, it prompts: E: You don’t have enough free space in /var/cache/apt/archives/.
- Restart and shutdown of Ubuntu system in the terminal
- Debian/Ubuntu uses proxy for gpg and apt-key-error resolution: gpg: keyserver receive failed: Connection timed out
- Ubuntu network configuration+Fixing “Failed to bring up eth0” in Ubuntu
- The method of getting shell command output in Python
- What are the common clearing commands in MATLAB?
- Several methods of executing multiple commands in Linux shell
- Linux shell RM deletes all. O suffix files in the subdirectory
- Linux shell loop in a line for while
- In Linux shell script, about the commonly used flag [- EQ, GT..] in test and if judgment
- The calling program in Linux calls the wrong Error opening terminal: unknown.
- Solutions to problems encountered when installing isc-dhcp-server on debian9.6
- launch failed.Binary Not found in Linux / Ubuntu solution