WindowsMacSoftwareSettingsSecurityAndroidProductivityLinuxPerformanceAppleDevice Manageme.. All

How to Configure DNS Settings on Fedora

Edited 3 weeks ago by ExtremeHow Editorial Team

FedoraDNS SettingsConfigurationNetworkSystem AdministrationCommand LineTerminalSoftwareSecurityComputers

How to Configure DNS Settings on Fedora

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.

Understanding DNS and its importance

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.

Prerequisites

Before you begin configuring DNS settings on Fedora, make sure that:

Editing DNS configuration files

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.

Method 1: Using the resolv.conf file

/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.

  1. Open a Terminal window. Fedora can be accessed by finding the Terminal through the Applications menu, or simply by pressing Ctrl + Alt + T.
  2. Enter the command:
    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.
  3. Edit the nameserver lines to specify your preferred DNS servers. For example:
    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.
  4. After editing, save your changes and exit the text editor. In Nano, you can save by pressing 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.

Method 2: Using NetworkManager

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:

  1. Open a terminal and use nmcli - the command-line interface for NetworkManager. Enter the following:
    nmcli dev show | grep DNS
    This command will show you the current DNS configuration for all devices.
  2. To update DNS settings, first identify the network connections. You can list all connections as follows:
    nmcli con show
  3. Select the connection you want to update, identified by its name. Let's say your connection ID is 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.
  4. To apply the changes, you must disconnect and reconnect to the network or restart NetworkManager:
    nmcli con up "Wired connection 1"systemctl restart NetworkManager

Permanent change

DNS configurations made via resolv.conf can potentially be overwritten, especially on reboot when NetworkManager recreates the file. To ensure your configurations persist:

Testing your configuration

After updating your DNS settings, it's important to make sure they work correctly.

  1. You can test DNS queries using tools like dig and nslookup. Install both of these if they aren't already installed:
    sudo dnf install bind-utils
  2. Use dig to get the domain information:
    dig example.com
    To verify that the DNS query is resolved correctly, check ANSWER SECTION.
  3. Use nslookup to verify DNS resolution:
    nslookup example.com

If you encounter any connectivity issues, reconsider your DNS configuration.

The case for custom DNS servers

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.

Conclusion

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


Comments