RackNerd Billboard Banner

How to Check DNS Server IP Address in Linux

When troubleshooting network issues or verifying system settings, knowing which DNS server your Linux machine is using can save you a lot of time. DNS (Domain Name System) is what translates human-readable domain names (like google.com) into IP addresses. If the DNS server is slow or misconfigured, you’ll experience delays or even connection failures.

This guide shows you several ways to check the DNS server IP address in Linux.


1. Check /etc/resolv.conf

Traditionally, Linux systems store DNS settings in the /etc/resolv.conf file. You can open it with:

cat /etc/resolv.conf

You’ll see something like:

nameserver 8.8.8.8
nameserver 8.8.4.4

Here, 8.8.8.8 and 8.8.4.4 are Google’s public DNS servers.

⚠️ Note: On modern systems using systemd-resolved, this file may just point to a stub resolver (127.0.0.53).


2. Use systemd-resolve (or resolvectl)

If your system runs systemd, you can check DNS details with:

systemd-resolve --status

or (on newer distributions):

resolvectl status

This command shows DNS servers per network interface, along with other useful info.


3. Use nmcli (for NetworkManager)

If you’re on a system managed by NetworkManager (common on desktops), you can run:

nmcli dev show | grep DNS

You’ll get output like:

IP4.DNS[1]: 192.168.1.1
IP4.DNS[2]: 8.8.8.8

This shows the DNS servers assigned to your system.


4. Use dig or nslookup to See Which DNS Is Queried

You can also test which DNS server your queries are hitting. For example:

dig google.com

At the bottom of the output, look for the SERVER line:

;; SERVER: 8.8.8.8#53(8.8.8.8)

That’s the DNS server used for the query.
Similarly, with nslookup:

nslookup google.com

You’ll see something like:

Server: 8.8.8.8
Address: 8.8.8.8#53

5. Check Active Network Config with ip or ifconfig

Sometimes your DNS is provided via DHCP. To confirm, you can inspect your network configuration:

nmcli device show

or

cat /run/systemd/resolve/resolv.conf

These files often reflect the DNS servers dynamically assigned by your router or ISP.


Wrapping Up

Linux offers multiple ways to check which DNS server you’re using. The right method depends on your distribution and setup:

  • /etc/resolv.conf for quick checks.
  • systemd-resolve or resolvectl if you’re on systemd.
  • nmcli if you use NetworkManager.
  • dig or nslookup to confirm which server answers queries.

Knowing where your system points for DNS is essential for fixing slow lookups, connection issues, or just confirming your machine uses the DNS server you expect.


💡 Support the Site
If this guide helped you, consider supporting us by trying Opera:

🔥 Download Opera GX (Gamer’s Browser)
🌍 Try Opera One (Multigeo)

Every install helps keep COMPUTER EVERYWHERE running — thank you! 🙌

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
RackNerd Billboard Banner
© 2025 Computer Everywhere
Your Everyday Guide to the Digital World.
Terms of Service | Privacy Policy
Copy link