Tutorial on modifying DNS server configuration for Linux VPS

888u

Last update at :2024-03-17,Edit by888u

Today, this site encountered a need to modify the DNS host of the VPS. The VPS is a Linux system, Debian 10. After searching for relevant tutorials, I found that there are temporary modifications and permanent modifications to modify the DNS host on Linux, which are not the same. The tutorial modification method is different, so I simply wrote a tutorial to record the Linux DNS configuration tutorial.

1. How to modify DNS in Linux

The different tutorials for this method are very unified and indeed effective. Just modify the configuration file directly:

vi /etc/resolv.conf

For example, if you change this to Google's DNS host, add these two commands at the bottom:

nameserver 8.8.8.8 nameserver 8.8.4.4

If you don’t know how to use the vim editor, you can refer to "Using vim to edit and create new files under Linux"

The modification will take effect directly. You can also check the new DNS host address through the nslookup command:

2. How to permanently modify DNS in Linux

Some tutorials say that the above modification methods are temporary and will become invalid after restarting the VPS, and provide relevant permanent modification methods.

1. Permanently modify DNS in CentOS system

Enter the following command:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Then change the nameserver or DNS values ​​in the last two lines to the values ​​we need.

2. Permanently modify DNS in Debian system

Enter the following command:

vi /etc/dhcp/dhclient.conf

Add the following characters to the last line:

prepend domain-name-servers 8.8.8.8, 8.8.4.4;

However, according to Lao Wang's actual measurement, the methods of permanently modifying the DNS host of VPS of different merchants are different. On DMIT VPS, just use the "temporary modification of DNS" command. It will still take effect after restarting. On Linode VPS, when modifying the resolv.conf file, it prompts that this file is a dynamic file and may be overwritten. Corresponding operations need to be performed, and even some modifications need to be made on the official website:

So how to permanently modify the DNS of VPS of different merchants is different. Please do it according to your actual situation.

Recommended site search: Guangzhou website registration, space registration, registered domain name purchase, IP, what is needed for website registration, free cloud computer host permanent use, domain name registration query, website registration information free overseas server, foreign server free IP address, < /p>

Tutorial on modifying DNS server configuration for Linux VPS

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码