Friday, December 14, 2012

Open FTP ports(20 and 21) through iptables

My IP Address is 192.168.163.25

go to

/etc/sysconfig/iptables

and the add the following lines before the first reject statement


-A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 192.168.163.25 --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -s 192.168.163.25 --sport 21 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

-A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 192.168.163.25 --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -p tcp -s 192.168.163.25 --sport 1024:65535 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

-A OUTPUT -p tcp -s 192.168.163.25 --sport 20 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 192.168.163.25 --dport 20 -m state --state ESTABLISHED -j ACCEPT


No comments:

Post a Comment