Resolving DNS Issues with resolvectl and systemd-resolved in a Home Network

Introduction to DNS Resolution

When setting up a home network, DNS resolution is one of those critical components that can be a real pain to troubleshoot. I’ve seen this go wrong when people are new to Linux, so let’s dive into how to use resolvectl to resolve DNS issues with systemd-resolved.

Understanding systemd-resolved

systemd-resolved is a system service that handles DNS resolution, among other network-related tasks. It’s part of the systemd suite and is widely used in many Linux distributions, including Ubuntu, Debian, and Fedora. The real trick is that systemd-resolved provides improved DNS security and better support for modern DNS protocols like DNS over TLS (DoT) and DNS over HTTPS (DoH). Don’t bother with trying to use it without understanding these benefits, as they’re a key part of what makes systemd-resolved so useful.

Using resolvectl

resolvectl is a command-line tool that lets you interact with systemd-resolved. It’s a powerful tool that allows you to query DNS records, configure DNS settings, and troubleshoot DNS issues. To use resolvectl, you’ll need to have systemd-resolved installed and running on your system. In practice, this means you’ll need to check that the systemd-resolved service is active and running.

Querying DNS Records

One common use of resolvectl is to query DNS records. For example, to query the IP address of a domain name, you can use the following command:

resolvectl query example.com

This will return the IP address of the domain name example.com. I usually start with this command when troubleshooting DNS issues, as it gives me a good idea of what’s going on.

Configuring DNS Settings

resolvectl also allows you to configure DNS settings, such as the DNS servers used by systemd-resolved. For example, to set the DNS servers to use Google’s public DNS servers, you can use the following command:

resolvectl dns google 8.8.8.8 8.8.4.4

This will set the DNS servers to use Google’s public DNS servers. This is where people usually get burned, as they forget to update their DNS settings after changing their network configuration.

Troubleshooting DNS Issues

resolvectl provides a number of useful features for troubleshooting DNS issues. For example, to check the status of systemd-resolved, you can use the following command:

resolvectl status

This will return information about the current status of systemd-resolved, including any error messages. This command is essential for figuring out what’s going on with your DNS resolution.

Security Considerations

When working with DNS resolution, there are a number of security considerations to keep in mind. One of the most important is to use a secure DNS protocol, such as DNS over TLS (DoT) or DNS over HTTPS (DoH). These protocols provide encryption for DNS traffic, which can help to prevent eavesdropping and tampering. To configure systemd-resolved to use a secure DNS protocol, you can use the following command:

resolvectl dns example.com +tls

This will configure systemd-resolved to use DNS over TLS (DoT) for the domain name example.com.

Additional Resources

For more information about systemd-resolved and resolvectl, you can refer to the systemd.io website, which provides detailed documentation and examples. Additionally, the Arch Linux wiki provides a number of useful articles and tutorials on using systemd-resolved and resolvectl.

Troubleshooting Tips

When troubleshooting DNS issues with systemd-resolved and resolvectl, there are a number of tips to keep in mind. First, make sure that systemd-resolved is running and configured correctly. You can check the status of systemd-resolved using the resolvectl status command. Second, make sure that your DNS settings are configured correctly. You can check your DNS settings using the resolvectl dns command. Finally, if you are experiencing issues with DNS resolution, try using a different DNS server or protocol. For example, you can try using Google’s public DNS servers or DNS over TLS (DoT).


See also