在 Ubuntu 上优化 vsftpd(Very Secure FTP Daemon) 的传输速度,可以从配置参数、系统内核、网络环境和客户端方式几个方面入手。下面按实用程度给你一套提速方案。
编辑配置文件(通常是):
sudo nano /etc/vsftpd.conf
reverse_lookup_enable=NO
默认开启会导致连接慢、卡顿。
anon_max_rate=0
local_max_rate=0
0表示不限速(生产环境可按需设置)
async_abor_enable=YES
pasv_enable=YES
pasv_min_port=40000
pasv_max_port=40100
然后在防火墙中放行:
sudo ufw allow 40000:40100/tcp
ls_recurse_enable=NO
dirlist_enable=YES
sudo nano /etc/sysctl.conf
添加:
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_window_scaling = 1
应用:
sudo sysctl -p
noatime 挂载:sudo nano /etc/fstab
示例:
/dev/sda1 /ftp ext4 defaults,noatime 0 2
ftp> binary
lftp(比 ftp 命令快很多)lftp -e "set net:timeout 10; pget -n 10 bigfile.iso" ftp://user@host
如果可以不用 FTP:
rsync -avzP file user@server:/path
ping server
traceroute server
iperf3 -c server
如果你愿意,可以告诉我:
我可以给你针对性配置。