August 20, 2008

Blocking a certain IP address with iptables

To block an ip address from accessing your linux box, you can use the following iptables rule:

iptables -A INPUT -s 222.124.24.131 -j DROP

If you just need to block a certain port (i.e. port 22 for SSH), you would do it like so:

iptables -A INPUT -s 222.124.24.131 -p tcp --destination-port 22 -j DROP

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.