Which Is My DNS Server Linux?


Scott Campbell

When it comes to managing your DNS server in Linux, one of the first things you need to know is which DNS server you are currently using. This information is essential for troubleshooting network issues, configuring domain names, and optimizing your server’s performance. In this article, we will explore different methods to determine your DNS server in Linux.

Method 1: Checking the resolv.conf file

The resolv.conf file is a configuration file that contains the settings for your DNS resolver in Linux. To check your DNS server using this method, follow these steps:

  1. Open a terminal: Launch the terminal application on your Linux system.
  2. Navigate to the resolv.conf file: Use the following command to navigate to the location of the resolv.conf file:
cd /etc
  1. View the content of resolv.conf: Use a text editor like nano or cat to view the content of the resolv.conf file. For example, you can use the following command:
cat resolv.conf

This will display the contents of the resolv.conf file on your terminal screen. Look for a line that starts with “nameserver”. The IP address mentioned next to “nameserver” indicates your DNS server.

Method 2: Using dig command

The dig command is a powerful tool for querying DNS servers and obtaining detailed information about them. Follow these steps to find your DNS server using dig:

  1. Open a terminal: Launch the terminal application on your Linux system.
  2. Type the following command:
dig +short NS google.com

This command queries the DNS server for the authoritative nameservers of the specified domain (here, google.com). The output will display the IP addresses of the DNS servers responsible for resolving that domain.

By default, this command will use the DNS server configured on your system. If you want to specify a different DNS server, you can add the “@ip_address” parameter to the command, replacing “ip_address” with the IP address of the desired DNS server.

Method 3: Using nmcli command

If you are using Network Manager on your Linux system, you can use the nmcli command-line tool to check your DNS server. Follow these steps:

nmcli dev show | grep 'IP4.DNS'

This command will display information about your network devices and their associated DNS servers. Look for “IP4.DNS” in the output to find your DNS server’s IP address.


Knowing which DNS server you are using in Linux is essential for managing network configurations effectively. By following these methods, you can easily determine your DNS server and make any necessary changes or optimizations as required.

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

Privacy Policy