Okay so I use the simple linux ftp client to download/upload files off ftp servers. I have an iptables firewall which blocks most of the ports and I have to close the firewall for it to work. Although port 21 is open but I guess that explains why the download works and not the upload. The following command works perfectly with the firewall on:
I just have problems when I actually connect to the server and try to "put"/upload a file to the server. Here is an example netstat output of the port used at that time but it's always different.
netstat -a | grep ServerIP tcp 0 197520 myIP.:59622 ServerIP:ftp-data ESTABLISHED tcp 0 0 myIP.:40341 ServerIP:ftp ESTABLISHED
Both the ports on myIP range are blocked and I'm failing to guess what ports do I have to open. Google search fails as well. Secondly, if I try something like this on iptables, it gives me an error:
-A INPUT -p tcp --match multiport --dport 40000:40500 -j ACCEPT iptables-restore v1.4.8: too many ports specified
Secondly, why would I need to open the ports when I have the following line before the ports were blocked in the configuration file:
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT