Iptables inside only 80, 21 and other commonly used ports, which led to VSFTPD in the passive mode can not use the random port, which caused the client to connect FTP can not list the directory such a problem. The solution is simple, adding a range of random ports to vsftpd and then adding this port range to iptables.
The following are specific practices:
1, modify the/etc/vsftpd/vsftpd.conf configuration file, add at the end of the file:
Copy Code code as follows:
pasv_max_port=6666
pasv_min_port=5555
/ETC/INIT.D/VSFTPD restart
2. Add a firewall rule
Copy Code code as follows:
/etc/init.d/iptables stop
Iptables-i input-p TCP--dport 5555:6666-j ACCEPT
/etc/init.d/iptables Save
/etc/init.d/iptables start
Finally the FTP connection again, successful.
The second method:
Add additional modules, Link Tracking module
Copy Code code as follows:
Iptables-a input-m State--state related,established-j ACCEPT
Modprobe ip_conntrack_ftp//temporary loading
/etc/sysconfig/iptables-config//this is permanent.
iptables_modules= "Ip_conntrack_netbios_ns ip_conntrack_ftp"
Service Iptables Restart