环境描述
1.操作系统:CentOS Linux release 7.9.2009 (Core)
2.vsftpd版本:
vsftpd-3.0.2-29.el7_9.x86_64
问题描述:
FTP服务器登陆缓慢,业务系统上传数据失败。本地测试发现,输入用户名和密码后,光标一直在闪烁,预计需要等待8-10s后返回登陆成功的字样。
原因分析:
vsftpd在新版本中默认加入了DNS反向解析,目的是确认源ip的可靠性。客户端登陆时,服务器在本地/etc/hosts文件或/etc/resolv.conf文件中指定的域名服务器内无法找到源ip地址,则会一直等待解析超时为止。结果就会导致上述我们看到的登陆缓慢。
什么是正向解析和反向解析
正向解析:根据域名查找对应的IP地址
反向解析:根据IP地址查找对应的域名
解决方案:
1.修改/etc/vsftpd/vsftpd.conf配置文件,文件末尾新增一行配置reverse_lookup_enable=NO
[echo "reverse_lookup_enable=NO" >> /etc/vsftpd/vsftpd.conf
2.reverse_lookup_enable配置项说明
reverse_lookup_enable
Set to YES if you want vsftpd to transform the ip address into the hostname, before pam authentication. This is useful if you use pam_access including the hostname. If you want vsftpd
to run on the environment where the reverse lookup for some hostname is available and the name server doesn’t respond for a while, you should set this to NO to avoid a performance
issue.
简单的可以总结为一句话,在没有DNS的环境下,需要将reverse_lookup_enable设置为NO,关闭反向解
Copyright © 2013-2021 8a.hk All Rights Reserved. 八艾云 版权所有 中山市八艾云计算有限公司 粤ICP备14095776号
增值电信业务经营许可证编号:B1-20222012
代理域名注册服务机构:西部数码