- 1 Minute to read
How to change DNS on Linux?
- 1 Minute to read
Generally, NordLayer application for Linux handles DNS settings automatically and manual DNS configuration should not be needed. However, in case of troubleshooting or specific scenarios, this guide will show you how to edit, add, or remove the DNS settings on your Linux device.
To get started, a few things can be done to make DNS handling as smooth as possible:
- Ensuring systemd-resolved is installed and running
- Making sure Cloudlfare DNS is reachable
Ensuring systemd-resolved is installed and running
- Open the terminal with the CTRL + ALT + T combination and type in the following commands:
systemctl status systemd-resolved
This will show detailed information about the service (you can exit by pressing q).
What is more, DNS servers should be visible per interface:
(You can use up/down keys to navigate and exit by pressing q)
systemd-resolved is automatically installed as part of systemd/resolvectl. It is activated by default on the most common Linux distributions. However, it can also be activated by entering:
sudo systemctl enable --now systemd-resolved
Making sure Cloudflare DNS is reachable
You can check whether DNS server is reachable:
(You can exit by pressing CTRL + C)
It should also be possible to perform DNS requests:
dig nordlayer.com @22.214.171.124
When systemd-resolve is not available
If neither systemd-resolve nor Network Manager are viable, it is recommended to install openresolv (for advanced users):
(On Ubuntu and Debian-based distributions)
sudo apt install openresolv
sudo dnf install openresolv
Choosing a different DNS server
You can use the default NordLayer DNS server, utilize ThreatBlock DNS settings or even set up custom DNS on your private dedicated server.
Setting DNS servers for manual VPN connection (when not using application)
When using a manual VPN connection, a DNS server can be set on the VPN interface (nlx0, tun0 or ovpn0), preferably through the System Settings or Network Manager. Alternatively, it can be set using openresolv. For example, OpenDNS uses:
- 126.96.36.199 for the primary server
- 188.8.131.52 for the secondary server
Note: In case you have any questions or are experiencing any issues, please feel free to contact our 24/7 customer support team.