How Do You Check Which DNS Server Is Being Used in Linux?

//

Heather Bennett

How Do You Check Which DNS Server Is Being Used in Linux?

Domain Name System (DNS) is a crucial component of the internet that translates human-readable domain names into IP addresses. Every time you access a website or use any internet service, your device relies on DNS servers to resolve the domain name and establish a connection.

But how do you check which DNS server is being used in Linux? In this tutorial, we will explore various methods to determine the DNS server configuration in different Linux distributions.

Method 1: Using the Command Line

One way to check the DNS server being used in Linux is by using the command line. Follow these steps:

  1. Open a terminal on your Linux system.
  2. Type the following command and press Enter: cat /etc/resolv.conf
  3. The output will display information about your DNS configuration. Look for the line starting with “nameserver” followed by an IP address. This IP address represents the DNS server being used by your system.

Note:

If you see multiple “nameserver” lines, it means your system is configured to use multiple DNS servers, and they are queried sequentially until a response is received.

Method 2: Using Network Manager Applet

If you are using a Linux distribution with Network Manager Applet installed, you can easily check the DNS server configuration through the graphical interface. Here’s how:

  1. Click on the network icon located in the system tray or status bar.
  2. Select “Connection Information” or similar options depending on your distribution.
  3. A new window will open displaying network information. Look for the “DNS Servers” field, which will show the IP address of the DNS server being used.

Method 3: Using the resolvectl Command

Another method to check the DNS server configuration in Linux is by using the resolvectl command. This command is part of systemd-resolved, a system service that manages network name resolution.

  1. Open a terminal on your Linux system.
  2. Type the following command and press Enter: resolvectl status
  3. The output will display detailed information about your DNS configuration, including the IP address of the currently used DNS server.

Note:

If you see multiple DNS servers listed under “DNS Servers,” it means your system is configured to use multiple servers in a round-robin fashion.

Conclusion

In this tutorial, we explored three different methods to check which DNS server is being used in Linux. Whether you prefer using the command line, graphical interface, or systemd-resolved commands, all these methods provide valuable insights into your DNS configuration.

Remember, understanding your DNS server settings can be useful for troubleshooting network issues or optimizing internet connectivity. By knowing which DNS server your Linux system uses, you can make informed decisions regarding performance and security enhancements.

Take charge of your DNS configuration in Linux and unlock a world of possibilities!

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy