Assume the server’s IP address is 125.121.156.156. Now we can block all ftp connections to the server withe the following ip tables rule
iptables -I INPUT -s 0.0.0.0 -d125.121.156.156 -p tcp -m tcp –dport 21 -j DROP
Now we can allow only authorised ip by the folloing rule. Assume the IP to be allowed is 121.125.121.125
iptables -I INPUT -s 121.125.121.125 -d 125.121.156.156 -p tcp -m tcp –dport 21 -j ACCEP
Now save the iptables rule using following command
/etc/init.d/iptables save




November 25th, 2009
Aneesh
Posted in 
