顶部右侧自定义内容
顶部左侧自定义内容
当前位置:首页 > 技术分享 > 正文

Linux下FTP服务器登陆缓慢超时问题分析

作者:xiaoyun发布时间:2022-01-23 14:57分类: 技术分享 浏览:463评论:0


导读: 环境描述 1.操作系统:CentOS Linux release 7.9.2009 (Core) 2.vsftpd版本: vsftpd-3.0....

环境描述

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,关闭反向解析,避免性能下降。


标签:


技术分享排行