Block IP from server using IPTables


If you want to block a specific IP address from a server (say, they are attacking you):

iptables -I INPUT -s address -j DROP

 

To block an entire subnet:

iptables -I INPUT -s ipaddress/range -j DROP

 

Example, using 192.168.1.5

iptables -I INPUT -s 192.168.1.5 -j DROP

 

or, the entire 192.168.1.0/24 range

iptables -I INPUT -s 192.168.1.0/255.255.255.0 -j DROP

or

iptables -I INPUT -s 192.168.1.0/24 -j DROP


Last update:
2012-10-14 00:40
Author:
Rod
Revision:
1.0
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags