In this tutorial, we will explore how to determine the DNS server that systemd-resolved is using on your system. Understanding the DNS server being used can be helpful for troubleshooting network connectivity issues or for configuring DNS settings.
What is systemd-resolved?
systemd-resolved is a system service in Linux distributions that provides network name resolution to local applications. It handles DNS queries and caching, as well as providing information about network connections.
Finding the DNS Server
To find out which DNS server systemd-resolved is using, follow these steps:
- Open the terminal: Launch your terminal application. You can typically find it in the Applications menu or by pressing
Ctrl + Alt + T.
- Check the status of systemd-resolved: Enter the following command to check if systemd-resolved is active:
$ systemctl status systemd-resolved
- Edit the resolved.conf file: Open the resolved.conf file in a text editor using root privileges.
This file contains configuration options for systemd-resolved.
$ sudo nano /etc/systemd/resolved.conf
- Locate the DNS server configuration: Inside the resolved.conf file, look for a line starting with DNS=. This line specifies one or more IP addresses of DNS servers separated by spaces.
- Note down the DNS server(s): Take note of the IP address(es) listed after DNS=. These are the DNS servers that systemd-resolved is currently configured to use.
Changing the DNS Server
If you want to change the DNS server that systemd-resolved is using, follow these steps:
- Edit the resolved.conf
- Modify the DNS configuration: Locate the line starting with DNS=. Update the IP address(es) with your desired DNS server(s). You can specify multiple DNS servers by separating them with spaces.
- Save and close the file: Press
Ctrl + Oto save the changes and then press
Ctrl + Xto exit the text editor.
- Restart systemd-resolved: Run the following command to restart the systemd-resolved service and apply your changes:
$ sudo systemctl restart systemd-resolved
Note: Applying Changes to Other Network Managers
If you are using a different network manager, such as NetworkManager or dhclient, they may override systemd-resolved’s DNS configuration. In such cases, you will need to update their respective configuration files or settings instead.
Determining which DNS server systemd-resolved is using can be helpful for troubleshooting network issues or configuring your system’s DNS settings. By following these steps, you can easily find and modify the DNS server configuration in resolved.conf.
Remember to restart systemd-resolved after making any changes for them to take effect. Keep in mind that other network managers may override systemd-resolved’s DNS configuration, so you may need to update their settings as well.
Now that you know how to find and change the DNS server being used by systemd-resolved, you have more control over your system’s network name resolution.