DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Ban IPs From A Server

01.21.2006
| 1399 views |
  • submit to reddit
        Use the code below to permanently ban an IP address from accessing your server.

iptables -A INPUT -s ip.address -j DROP
    

Comments

Snippets Manager replied on Wed, 2009/02/25 - 9:47am

To block a range of ip addresses using iptables, use the following: iptables -I INPUT -m iprange --src-range - -j DROP example: iptables -I INPUT -m iprange --src-range 94.69.44.1-94.69.44.255 -j DROP