iptables Configuration for FTP Server VSFTPD


Linux IPTables Configuration for Allow VSFTPD FTP Incoming and Outgoing Traffic on CentOS Fedora Redhat Ubuntu

IPTables FTP Accept

1) Add following lines in /etc/modprobe.conf

alias ip_conntrack ip_conntract_ftp ip_nat_ftp

or run

# modprobe ip_conntrack_ftp 
#modprobe ip_nat_ftp

2) Allow incoming traffic on the default Ftp port (21)

a) run the following command in Linux shell

# iptables -A INPUT -p tcp –dport 21 -j ACCEPT

b) or You can manually edit /etc/sysconfig/iptables and add the below mentioned line

-A INPUT -p tcp -m tcp –dport  21 -j ACCEPT 

3) Save and Restart iptables
save this configuration
# iptables-save >  /etc/sysconfig/iptables
or
#service iptables save

#service iptables start

Now the FTP ports will be enabled in iptables.