buy tb500

How do I block an IP address from my server?

If you want to block access to your server for whatever reason, you will need to log into the shell as root. Your server should either have ipchains or iptables to help accomplish this. In this example, the attacking IP is

Issue the appropriate command in a terminal session:

  • If you are using ipchains: ipchains -A input -j DENY -p all -l -s
  • If you are using iptables: iptables -A INPUT -s -j DROP

If you just want to block access to one port from an IP :

  • iptables -A INPUT -s -p tcp –destination-port 23 -j DROP

The above would drop all packets from to port 23 (Telnet) on the server.

There are many in-depth tutorials available on the Internet. Consult your favorite search engine for more information.


Leave a Reply