DNS configuration: Requests to setup or modify DNS settings for the server.

A Step-by-Step Guide to Resolving DNS Configuration Issues Using nmcli Commands

A Step-by-Step Guide to Resolving DNS Configuration Issues Using nmcli Commands

Introduction:

DNS (Domain Name System) plays a critical role in translating human-readable domain names into machine-readable IP addresses. Ensuring the correct DNS settings for your server is vital for smooth internet connectivity and efficient web browsing. However, there are instances where you may encounter issues with DNS configuration, causing disruptions to your server's functionality. In this blog post, we will walk you through the process of using nmcli commands to set up or modify DNS settings on your server and resolve DNS-related issues.

Step 1: Check Current DNS Settings

Before making any changes, let's first check the current DNS settings on your server. Open a terminal or SSH session and enter the following command:

nmcli connection show enp0s3 | grep dns

This command will display the existing DNS configuration for the network interface "enp0s3." Note down the current settings for reference.

Step 2: Modify DNS Settings

To change the DNS server, we'll use the nmcli connection modify command. Replace "1.1.1.1" with the desired DNS server address. For example, we'll use Cloudflare's DNS server "1.1.1.1":

nmcli connection modify enp0s3 ipv4.dns "1.1.1.1"

This command sets the primary DNS server for the "enp0s3" interface to "1.1.1.1." If you want to set multiple DNS servers, you can add them as a comma-separated list within double quotes, e.g., "1.1.1.1,8.8.8.8".

Step 3: Verify DNS Settings

To ensure that the DNS settings have been successfully modified, re-run the command from Step 1:

nmcli connection show enp0s3 | grep dns

Now, you should see the updated DNS configuration with the new DNS server address.

Step 4: Apply Changes

To apply the changes, you need to bring down the network interface and then bring it back up. Use the following commands:

nmcli connection down enp0s3
nmcli connection up enp0s3

The first command (nmcli connection down enp0s3) takes the "enp0s3" interface offline, and the second command (nmcli connection up enp0s3) brings it back online with the modified DNS settings.

Conclusion:

Configuring DNS settings is a common requirement when managing a server, and it's essential to know how to handle DNS-related issues effectively. By using the nmcli commands provided in this guide, you can easily set up or modify DNS settings and resolve DNS configuration issues on your server. Remember to double-check your changes and take necessary precautions before applying modifications to avoid potential connectivity problems. A properly configured DNS ensures a smooth and reliable network experience for your server and its users.

Note: Before making any changes to your server's DNS settings, ensure you have proper authorization and a good understanding of the implications of these changes. Additionally, it's recommended to take a backup of the configuration file or note down the original settings in case you need to revert the changes.

Comments