Discovering
How To Know Your DNS Server?
Section titled “How To Know Your DNS Server?”1. GNU/Linux
Section titled “1. GNU/Linux”1.1. First Attempt
Section titled “1.1. First Attempt”In your command line, it’s just needed to type the following command which is the universal method for every distribution:
cat /etc/resolv.confHere’s the sample output on the end of the terminal:
nameserver 8.8.8.8 nameserver 192.168.0.1Nevertheless, on many modern Linux distributions, the resolv.conf file might point to a local caching server, like the following output:
# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8). # Do not edit. # # This file might be symlinked as /etc/resolv.conf. If you're looking at # /etc/resolv.conf and seeing this text, you have followed the symlink. # # This is a dynamic resolv.conf file for connecting local clients to the # internal DNS stub resolver of systemd-resolved. This file lists all # configured search domains. # # Run "resolvectl status" to see details about the uplink DNS servers # currently in use. # # Third party programs should typically not access this file directly, but only # through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a # different way, replace this symlink by a static file or a different symlink. # # See man:systemd-resolved.service(8) for details about the supported modes of # operation for /etc/resolv.conf.
nameserver 127.0.0.53 options edns0 trust-ad search .O endereço 127.0.0.53 é um IP de loopback local usado por sistemas Linux modernos (como Ubuntu) para o serviço systemd-resolved, que atua como um resolvedor DNS de cache local.
Ele substitui o antigo servidor DNS configurado diretamente no /etc/resolv.conf, agindo como um intermediário que encaminha consultas para servidores upstream, melhorando a eficiência e o cache local.
É um DNS stub listener que gerencia as requisições de DNS do sistema, sendo parte da rede local (127.0.0.0/8).
systemd-resolved: Este serviço escuta na porta 53 (127.0.0.53#53) para processar as consultas.
Conflitos: Pode causar conflitos se você tentar rodar outro servidor DNS local (como BIND ou Pi-hole) na mesma porta.
Como verificar: O comando resolvectl status mostra o status do resolvedor.
Como alterar: Para desativar e usar um servidor DNS tradicional, o serviço systemd-resolved deve ser desativado, o link simbólico /etc/resolv.conf desfeito e configurado manualmente.
1.2. Second Attempt
Section titled “1.2. Second Attempt”systemd-resolved is a systemd service that provides network name resolution to local applications via a D-Bus interface, stub resolver (127.0.0.53), and NSS service.
It improves performance with caching, supports DNSSEC validation, and handles split DNS for VPNs.
It is commonly enable by default replacing traditional /etc/resolv.conf manegament.
Also it is common in modern Ubuntu-based (Linux Mint, Pop!_OS, ZorinOS, and ElementaryOS) Fedora, and Debian.
Anyhoo, the resolvectl command provides detaild DNS information for all network interfaces:
resolvectl statusOutput:
Global Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported resolv.conf mode: stub
Link 2 (enp2s0f1) Current Scopes: none Protocols: -DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Link 3 (wlp3s0) Current Scopes: DNS Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported Current DNS Server: 1.1.1.1 DNS Servers: 1.1.1.1It is also possible to filter the output for just the DNS information using grep:
resolvectl status | grep "DNS Servers"Output:
DNS Servers: 1.1.1.1