Restricting access to certain ports to IPs?

Hello,

I was wondering if it is possible to restrict certain ports to certain IPs. I am using IPTables.

For example I will only allow login to SSH from my home IP address and another friends home just in case mine changes. This is essentially blocking port 22 from everyone but my IP, is this possible or is there a better way of doing this?

This just sounds a more secure way of doing things and it would make it almost impossible for them to gain access by root.

Thank you

 

 

 

 

Top