Focus on cloud service provider activities
Notes on website operation and maintenance

Record the process of modifying DNS in CentOS

Sometimes the speed of the overseas servers we choose is not very fast, which is also affected by the DNS problem. Here we record how to change and modify DNS in CentOS to improve the speed.

1. Open network profile:

 sudo vi /etc/sysconfig/network-scripts/ifcfg-<interface>

Replace<interface>with your network interface name (for example, eth0)。

2. In the open file, locate and edit the following line:

 DNS1=<primary DNS> DNS2=<secondary DNS>

Replace<primary DNS>and<secondary DNS>with the IP addresses of the primary and standby DNS servers you want to set. If there is only one DNS server, please reserve only the DNS1=line and set it to the corresponding IP address.

Save and close the file.

3. Restart the network service for the changes to take effect:

 sudo systemctl restart network

4. Check if DNS settings have been updated:

 cat /etc/resolv.conf

Make sure that the nameserver line shows the IP address of the DNS server we set.

Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Record the process of modifying DNS in CentOS


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge