block ssh and ftp for some ips

Hi i wish to block a server from certain ips to port ssh and ftp iwant to give access to those ips that i want and for the rest ips to be blocked because there are two many people trying to sign on by ssh and other trying to connect using strange ports.
i think with iptables i can do it but i'm not sure.

 

 

 

 

Top