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

Linux servers permanently and temporarily modify DNS to improve loading speed

Sometimes the ECS network looks good, but the response speed is slow when it is opened. This may be due to DNS problems. Here, we can modify DNS temporarily and permanently.

Temporarily modify DNS method

If we use it temporarily, we can also modify DNS temporarily.

Modify the following files:

 vi /etc/resolv.conf

Join the DNS you want to modify

 nameserver 1.1.1.1 nameserver 8.8.8.8

Change to

 nameserver 119.29.29.29 nameserver 8.8.8.8

Permanently modify DNS method

1. Modify the/etc/systemd/resolved.conf file

 vi /etc/systemd/resolved.conf

Here we can see these parameters:

 #Specify DNS servers, separated by blanks, and support IPv4 or IPv6 locations DNS=119.29.29.29 114.114.115.115 #Alternate DNS server FallbackDNS=8.8.8.8 #Set search domain name Domains=domain.com #Set whether LLMNR is activated. The available options are yes no、resolve LLMNR=yes #Set whether MulticastDNS is activated. The available options are yes no、resolve MulticastDNS=yes #Set whether DNSSEC is activated. The available options are yes no、allow-downgrade DNSSEC=yes #Set whether the cache is activated. The available options are yes no、no-negative Cache=no-negative

Modify the DNS in the resolved.conf file as needed, and then save it.

2. Restart the system resolved service

 systemctl restart systemd-resolved

3. Set the boot to start the system resolved service

 systemctl enable systemd-resolved

4. Back up the systemd resolved managed file resolv.conf

 mv /etc/resolv.conf /etc/resolv.conf.bak

Rebuild.

 ln -s /run/systemd/resolve/resolv.conf /etc/
Vote for you
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 » Linux servers permanently and temporarily modify DNS to improve loading speed