How to Change the DNS Server on a Linux Cloud Server?

22-02-2024 03:14:03

This article outlines the steps required to modify the DNS server settings on a Linux cloud server. Local DNS servers in various countries can be found through search engine queries; please replace them accordingly in practical application. This guide is applicable to a variety of Linux operating systems, including CentOS, Fedora, Ubuntu, Debian, and others.

1.Remotely log into the system.

2.Edit the file containing the DNS server settings.

vi /etc/resolv.conf

Alternatively,

nano /etc/resolv.conf

3.Replace [ns1] and [ns2] with the new DNS server addresses, and save the file by entering :wq.

nameserver [ns1]
nameserver [ns2]

4.Use the ping command to test several common domain names. If IP addresses appear, it indicates that the DNS server is functioning correctly.

ping www.google.com