« Back to Networking: Frequently Asked Questions

How to see which DNS server is used

How to see which DNS server is used on Linux?

When the Linux system is using systemd, use the resolvectl command to see the active DNS server. Otherwise, have a look in /etc/resolv.conf.

resolvectl

Systems using systemd have the resolvectl command to show the configured DNS servers. It also show the server that is currently active.

Show active DNS configuration

Run the resolvectl command without any options to see the status. The configured DNS servers will be displayed, including the one that is currently being used.

# resolvectl
Global
       Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub

Link 2 (ens18)
    Current Scopes: DNS
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.1.10
       DNS Servers: 192.168.1.10 192.168.1.11
        DNS Domain: internal.example.com

Not using systemd?

When systemd is not being used, then typically the first DNS server configured in the file /etc/resolv.conf is used for processing the DNS requests.

Learn more about resolvectl

This article uses the resolvectl command to achieve its tasks. Want to learn how to use it or additional options that may be available?

Other questions related to Networking

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    Small picture of Michael Boelen

    This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

    Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

    Mastodon icon