Edited 3 weeks ago by ExtremeHow Editorial Team
FedoraDNS SettingsConfigurationNetworkSystem AdministrationCommand LineTerminalSoftwareSecurityComputers
This content is available in 7 different language
Configuring DNS (Domain Name System) settings is an important task when setting up a Fedora system, as these settings determine how your system translates domain names to IP addresses. This guide will walk you through the process of setting up DNS settings on the Fedora operating system. Please follow the steps carefully to ensure proper configuration.
DNS is like the phonebook of the Internet. When you type a web address such as www.example.com
into your web browser, DNS translates it into a computer-friendly IP address such as 192.0.2.1
or an IPv6 address. Without DNS, you would have to remember these numerical addresses to visit a website. DNS also supports other important functions such as email routing.
Before you begin configuring DNS settings on Fedora, make sure that:
In Fedora, the necessary DNS configuration can be managed primarily through resolv.conf
file and NetworkManager, which is a tool that handles network connections and can manage DNS settings, among other tasks.
/etc/resolv.conf
file is the traditional configuration file for DNS settings. This file usually contains nameserver
entries that point to DNS servers. To manually modify DNS settings, you can edit this file.
Ctrl + Alt + T
.sudo nano /etc/resolv.conf
This will open the resolv.conf
file in the nano text editor, or you can use another editor of your choice like vim
or gedit
.nameserver 8.8.8.8 nameserver 8.8.4.4
These lines instruct the system to use Google’s public DNS servers. You can replace these with different DNS server IPs from users like OpenDNS, Cloudflare or any DNS service of your choice.Ctrl + O
, pressing Enter
, and then pressing Ctrl + X
.It is important to note that if your system is using NetworkManager (which is the default in Fedora), your changes may be overwritten. This is because NetworkManager sometimes dynamically generates resolv.conf
.
NetworkManager is an effective utility that manages network connections and much more, working in the background. Here is how to configure DNS settings using NetworkManager:
nmcli dev show | grep DNS
This command will show you the current DNS configuration for all devices.nmcli con show
Wired connection 1
To change DNS:nmcli con mod "Wired connection 1" ipv4.dns "8.8.8.8 8.8.4.4"
Replace 8.8.8.8 8.8.4.4
with your desired DNS server IP address, separated by a space.nmcli con up "Wired connection 1"
systemctl restart NetworkManager
DNS configurations made via resolv.conf
can potentially be overwritten, especially on reboot when NetworkManager recreates the file. To ensure your configurations persist:
resolv.conf
. Therefore, it is better to configure via NetworkManager for consistency of settings.After updating your DNS settings, it's important to make sure they work correctly.
dig
and nslookup
. Install both of these if they aren't already installed:sudo dnf install bind-utils
dig
to get the domain information:dig example.com
To verify that the DNS query is resolved correctly, check ANSWER SECTION
.nslookup
to verify DNS resolution:nslookup example.com
If you encounter any connectivity issues, reconsider your DNS configuration.
Using a customized DNS server can improve your security, privacy, and performance compared to the default ISP-based DNS server. Widespread services such as Google Public DNS, Cloudflare DNS (1.1.1.1) and OpenDNS offer increased speed and reliability with additional benefits such as ad-blocking or filtering inappropriate content.
Setting DNS settings correctly on Fedora is fundamental to an efficient and secure online experience. Whether using resolv.conf
or NetworkManager methods, Fedora offers capability and flexibility. Following structured methods ensures that settings are configured correctly, avoids overwriting and ensures seamless operation network-wide or locally.
Setup and configuration are simple processes, yet have a significant impact on your interactions online. Choose your DNS servers carefully, implementing this simple but comprehensive guide on Fedora ensures a functional and robust solution.
If you find anything wrong with the article content, you can