Skip to Content

4 ways to Check DNS Server in Ubuntu


When you browse the internet, you are actually accessing different websites by their domain names. However, your computer doesn’t understand domain names, so it needs to translate them into IP addresses.

This is where Domain Name System (DNS) servers come into play. A DNS server is responsible for translating domain names into IP addresses. In this blog post, we will discuss how to check DNS server in Ubuntu.

Check DNS Server with systemd-resolve command in Ubuntu

In Ubuntu, you can check the DNS server by using the systemd-resolve command. Open the terminal and type the following command:

systemd-resolve --status | grep 'DNS Servers'

This command will display the DNS server that your system is currently using. If you have multiple DNS servers configured, it will show all of them.

For example,

# systemd-resolve --status | grep 'DNS Servers'
DNS Servers**:

In Ubuntu 18.04 and 20.04 we can use systemd-resolve –status. In newer versions, we can use resolvectl status.

Check DNS server with tcpdump command in Ubuntu

You can also check the DNS server in Ubuntu using the tcpdump command. Open the terminal and type the following command:

sudo tcpdump -n -i any port 53

This command will display all DNS traffic on your system, including the DNS servers that your system is using.

You can stop the command by pressing Ctrl+C. This method is useful for troubleshooting DNS issues or for monitoring DNS traffic on your system.

Here is one example of this.

13:52:05.279330 IP > 34214+ [1au] A? (60)
13:52:05.279481 IP > 22036+ [1au] AAAA? (60)
13:52:05.281134 IP > 34214 1/0/1 A (76)
13:52:05.281543 IP > 22036 0/1/1 (138)

This is the command output in my system. We can see that is the DNS server.

Find DNS server with dig command in Ubuntu

You can also check the DNS server in Ubuntu using the dig command. Open the terminal and type the following command:


This command will display the IP address of the DNS server that was used to resolve the domain name of

You can replace with any other domain name to check which DNS server was used to resolve it.

For example,

# dig
; <<>> DiG 9.16.1-Ubuntu <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6566
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
; EDNS: version: 0, flags:; udp: 65494
;            IN  A
;; ANSWER SECTION:     73  IN  A
;; Query time: 0 msec
;; WHEN: Tue Feb 28 13:56:59 UTC 2023
;; MSG SIZE rcvd: 55

From the output, we can see that is the local DNS server ip. is the address of the local caching stub resolver. It forwards DNS requests to whatever upstream DNS servers you specify.

Most distributions of Linux nowadays use local resolvers, which essentially cache DNS lookup results on your local computer. It’s just an additional layer in between your computer and the DNS server.

Checking DNS Server in Ubuntu Network Manager

If you are using Network Manager to manage your network connections, you can also check the DNS server that your system is using through the GUI. Follow these steps:

  1. Click on the Network Manager icon in the top-right corner of the screen.
  2. Click on the gear icon next to the network you are connected to.
  3. Click on the IPv4 or IPv6 tab, depending on which protocol you are using.
  4. Under the DNS section, you will see the DNS servers that your system is currently using.


nmcli is a command-line tool provided by NetworkManager, which is widely used in many Linux distributions, including Ubuntu, for network configuration and management.

The command nmcli dev show | grep ‘IP4.DNS’ is used in Unix-like operating systems, such as Ubuntu, to display the DNS server settings for network interfaces managed by NetworkManager.

nmcli dev show | grep 'IP4.DNS'

dev show:

  • dev is short for device. This part of the command requests information about network devices.
  • show tells nmcli to display detailed information about each network device.

| grep ‘IP4.DNS’:

  • The pipe symbol | is used to pass the output of the preceding command (nmcli dev show) to another command.
  • grep is a command-line utility used for searching plain-text data for lines that match a regular expression.
  • ‘IP4.DNS’ is the regular expression. In this context, it tells grep to filter and display only those lines of the output that contain ‘IP4.DNS’.



In this blog post, we have discussed how to check DNS server in Ubuntu. By using the systemd-resolve command, tcpdump command and network manager. Knowing which DNS server your system is using can be helpful in troubleshooting network issues or configuring your network settings.

Eric H

Sunday 26th of November 2023

The methods you've outlined are clear and easy to follow, making them accessible even to those new to Ubuntu.

Articles like this are invaluable for both beginners and experienced users who need a quick refresher on managing network settings in Linux environments.