We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

Allowing FTP Through IPTABLES

2016-03-09, 06:44 PM

I've been trying to properly setup my iptables for the past few days. I'm using centos 7. I can allow the ports I need, like mysql (3306) and 25565 for Minecraft just fine. My issue is that all of the rules I have tried for ftp ports 20 and 21 do not seem to work.

I have tried the following rules with no luck. Are one of the default rules overriding here?
-A INPUT --dport 21 any -j ACCEPT
-A INPUT --dport 20 any -j ACCEPT

-A INPUT -p tcp --dport 21 -j ACCEPT
-A INPUT -p tcp --dport 20 -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 20 -j ACCEPT

-A INPUT -p tcp -s 0/0 -d 0/0 --destination-port 20 -j ACCEPT
-A INPUT -p tcp -s 0/0 -d 0/0 --destination-port 21 -j ACCEPT
Here are the rules I'm using now. It's just default for a good clean start.

My overall goal for my tables is to allow all output and block all input. Input being allowed only through exception rules such as the code above. Thank you, this is my last resort after 2 days of trying.