The problem of slow resolution of domain names by LINUX DNS clients.

The configuration file for domain name resolution under Linux system is /etc/resolv.conf

cat /etc/resolv.conf
# Generated by NetworkManager
options single-request-reopen
nameserver 114.114.114.114

One of the reasons for the slow resolution of LINUX DNS clients is that CentOS 6/CentOS 7 always needs to wait for the result of AAAA (IPv6), even disabling IPv6 is useless. The DNS resolver in CentOS 6/CentOS 7 uses the same socket interface for both ipv4 and ipv6 (as shown in the figure above). After sending ipv4 and ipv6 parsing requests at the same time, only one ipv4 parsing response is received. At this time, the socket will be a In "waiting" mode, waiting for the ipv6 parsing response, so the parsing is slow; after adding single-request-reopen, a new socket can be reopened to receive the ipv6 parsing response without affecting the ipv4 parsing response.

cat /etc/resolv.conf
options timeout:1 attempts:1 rotate
nameserver 114.114.114.114
nameserver 8.8.8.8
nameserver 1.1.1.1

rotate: The meaning of this parameter is to randomly select a dns server as a query. The default is from top to bottom in order.

timeout: Timeout for querying a nameserver, in seconds. The system default is 5, the maximum can be set to 30. Set the timeout to 1S, otherwise it will be a waste of time when AAAA responds.

attempts: This is the number of times the entire query is tried. By default, LINUX will issue several DNS query packets, so you can check it once, which is a waste of time.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325206817&siteId=291194637