Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
In the Linux environment, managing DNS resolution is a crucial task for ensuring that your system can correctly translate domain names into IP addresses. One of the tools available for this purpose is resolvectl
, which is part of the systemd-resolved
service. This command-line utility allows you to query and manage DNS settings, making it easier to troubleshoot and configure DNS resolution on your system.
Understanding how to use resolvectl
can be particularly important for system administrators and network engineers who need to ensure the reliability and efficiency of network communications. This article will guide you through the basics of using resolvectl
on a Linux system, including practical examples to illustrate its functionality.
Examples:
Querying DNS Information:
To query DNS information for a specific domain, you can use the resolvectl query
command. This command will display the IP addresses associated with the domain name.
resolvectl query example.com
Output:
example.com: 93.184.216.34
Checking the DNS Servers:
You can check which DNS servers your system is currently using with the resolvectl status
command. This will provide detailed information about the DNS configuration.
resolvectl status
Output:
Global
LLMNR setting: yes
MulticastDNS setting: yes
DNSOverTLS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 8.8.8.8
8.8.4.4
Setting DNS Servers:
To set specific DNS servers for a network interface, you can use the resolvectl dns
command followed by the interface name and the DNS server addresses.
resolvectl dns eth0 8.8.8.8 8.8.4.4
This command configures the eth0
interface to use Google's public DNS servers.
Flushing DNS Cache:
If you need to clear the DNS cache, you can use the resolvectl flush-caches
command. This can be useful if you are troubleshooting DNS issues and want to ensure that you are getting fresh DNS data.
resolvectl flush-caches
Enabling or Disabling LLMNR:
Link-Local Multicast Name Resolution (LLMNR) can be enabled or disabled using the resolvectl llmnr
command. This can be useful in environments where LLMNR is either required or needs to be disabled for security reasons.
resolvectl llmnr yes
To disable LLMNR:
resolvectl llmnr no