Slow SSH connection and reverse resolution

Source: Internet
Author: User
Tags reverse dns

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.