Below is a step-by-step guide on how to locate your DNS Server settings on a Linux server.
Systemd resolve hierarchy.
This article assumes that /etc/nsswitch.conf is configured to refer to /etc/resolv.conf, which is the case by default on most distributions. This is defined in the hosts: line like the following example of an AlmaLinux Server:
hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname- SSH into your server as the root user.
- Edit the /etc/resolv.conf file using a tool such as vim or nano. In the below example, it is pointing at Indigo Legacy Resolvers, and needs to be changed.
nameserver 114.141.193.250 nameserver 114.141.200.250 Update it to point to the correct servers, and then save the file.
nameserver 221.121.130.3 nameserver 221.121.134.9Your DNS resolvers will now be updated. If this is CentOS, you should have a quick look in your /etc/sysconfig/network-scripts/ifcfg-* files and see if they have DNS1= and DNS2= lines. If they do, you will need to also update those lines to the new Resolvers shown above.
DEVICE=enp1s0 TYPE=Ethernet BOOTPROTO=none ONBOOT=yes PREFIX=24 IPADDR=10.0.1.27 GATEWAY=10.0.1.1 DNS1= 221.121.130.3 DNS2=221.121.134.9Barring edge cases, you should now be correctly configured.