LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-07-2011, 06:11 AM   #1
Amerika
LQ Newbie
 
Registered: Dec 2010
Posts: 18

Rep: Reputation: 0
Iptables mass ban ip


Im not sure how to ban many ip's at once, i just know only how to ban 1 ip at once.

For example:
How can i ban this ip range 212.87.164.0-212.87.165.255 with iptables, is it even possible?
 
Old 10-07-2011, 06:29 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Sure, just write the ip as 212.87.165.0/23 no other changes required.
 
Old 10-07-2011, 07:12 AM   #3
Amerika
LQ Newbie
 
Registered: Dec 2010
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by acid_kewpie View Post
Sure, just write the ip as 212.87.165.0/23 no other changes required.
From what range this 212.87.165.0/23 bannes?
From 212.87.165.0 to 212.87.165.23 ?
 
Old 10-07-2011, 07:18 AM   #4
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
sorry wrong Reply to this thread

Last edited by lithos; 10-07-2011 at 07:19 AM.
 
Old 10-07-2011, 07:55 AM   #5
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 190Reputation: 190
check if the iprange module is installed with
Code:
# iptables -m iprange --help
that help page tells you how to use it (assuming its installed)

example:
Code:
iptables -A INPUT -m iprange --src-range 10.0.0.10-10.0.0.20 -j DROP
 
Old 10-07-2011, 08:08 AM   #6
Amerika
LQ Newbie
 
Registered: Dec 2010
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by fukawi1 View Post
check if the iprange module is installed with
Code:
# iptables -m iprange --help
that help page tells you how to use it (assuming its installed)

example:
Code:
iptables -A INPUT -m iprange --src-range 10.0.0.10-10.0.0.20 -j DROP
Thanks this helped!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ban a Range of IPs in iptables userlander Linux - Networking 4 11-13-2008 02:07 PM
Iptables, ban IP, how? cylarz Linux - Security 3 04-22-2006 02:09 PM
Quick iptables IP address ban? Davus Linux - Networking 2 11-18-2004 09:53 PM
iptables ban rule hypton Linux - Networking 1 03-09-2004 11:42 PM
using iptables to ban a subnet? Sm0k3 Linux - Networking 4 01-24-2004 04:25 PM


All times are GMT -5. The time now is 04:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration