When connecting to servers such as Apache, ssh, and MySQL, if the connection is slow, the possible cause is reverse DNS query.
Reverse resolution is to prevent fake IP addresses from connecting to the server and resolve the IP address into a domain name to improve installation. It is one of the functions of reverse DNS query to check whether the IP address is forged.
If the connection is too slow after you enable reverse resolution for servers such as Apache, ssh, and MySQL. There are two solutions:
1. Disable the DNS reverse resolution function of the service.
2. Create your own DNS resolution or change the hosts file.
1. Disable reverse resolution for SSH
After DNS reverse resolution is disabled, counterfeit IP login cannot be prevented.
The procedure is as follows:
(1) Cancel DNS reverse resolution of sshd service
# Vi/etc/ssh/sshd_config
(2) locate the usedns option, cancel the annotation, and change it
Usedns No
(3) restart the sshd service
/Etc/init. d/sshd restart
2. Architecture DNS server: add the Domain Name of the server
Build your own DNS server. Because the record needs DNS resolution, the program needs PTR reverse resolution, that is, the ing between the IP address and domain name. It has verified whether the IP address is a valid IP address.
Two methods:
(1) write common IP addresses to the hosts file, and then check whether the program first queries the hosts file in/etc/nsswitch. conf (this is usually the default ).
(2) Start a DNS server (which can be a local machine), add reverse resolution, and add the DNS server to/etc/resolv. conf.