block consecutive IP address using scripts



How to block long list of consecutive IP address?
How to call linux route command inside a script?
How to block consecutive IP address using bash script or perl script?
How to block local IP address permanently?

The are times that a server does not need to listen and process any TCP/UDP request for a long list of consecutive local IP addresses.

This blog entry provides a starting point of creating server scripts to block a long list of consecutive IP address from the server for permanent blocking.

To start, launch your fave editor and create a IPblock.sh bash script like with contents similar to the next few lines. This blog entry assumes that you have bash shell and perl currently installed from the machine.
From below example, we are permanently blocking IP address from
192.168.0.10 to 192.168.0.254.
Here's a simple sample script that does the job.
#!/bin/bash
echo Blocking started ...

for ((i=10;i<=254;i=i+1)); do /sbin/route add -host 192.168.0.$i reject done echo Done
This can also be accomplished using perl script which does the same function. Create a separate IPblock.pl perl script like so.
#!/usr/bin/perl -w

my $i;
for ($i=10; $i<=254; $i++ ) { system ("/sbin/route del -host 192.168.0.$i reject"); } }
Make sure these scripts are root executable like so
# chmod 700 IPblock.sh
# chmod 700 IPblock.pl
Now, to execute individually
# ./IPblock.sh
# ./IPblock.pl
Additionally, the above scripts can be scheduled for regular execution if you need them so by using crontab utility.




Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

436 comments:

«Oldest   ‹Older   401 – 436 of 436   Newer›   Newest»
ajay said...

This is really too useful and have more ideas from yours. Keep sharing many techniques and thanks for sharing the information.
Ethical Hacking Training in Chennai | Ethical Hacking Training in Velachery | Ethical Hacking Training in Taramani | Ethical Hacking Training in Pallikaranai | Ethical Hacking Training in OMR

rajinikumar said...

Wow!! What a interesting blog..Thanks The information which you provided is very much useful and easy to learn as well...keep rocking and updating... looking further..
Best CCNA Training Institute in Kanchipuram

Suganya said...

Awesome blog. Your articles really impressed for me, because of all information so nice and unique...
CCNA Certification course in Chennai | Cisco Certification in Velachery

Deepa said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.
Java Training Institute in Chennai | Java Training in Velachery | Java Training in Taramani

roja said...

It's very great post... Really you are... done a wonderful job Keep up the good work and continue sharing like this.
Tally Training in Chennai | Tally Training in Velachery | Tally Training in Guindy | Tally Course in Taramani

Deepa said...

I enjoyed reading the Post. It was very informative and useful. Thanks for sharing. Keep updating your blog...
Python Training Institute in Chennai | Python Training in Velachery | Python Training in Pallikaranai | Python Training in Keelkattalai

Jasmine said...

Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.
Web Designing Training in Chennai | Web Designing Training in Velachery | Web Designing Training in Taramani | Web Designing Training in Pallavaram

Chris Hemsworth said...

The article is so informative. This is more helpful for our
Learn best software testing online certification course class in chennai with placement
Best selenium testing online course training in chennai
Best online software testing training course institute in chennai with placement
Thanks for sharing.

Deepa said...

Really very nice blog information for this one and more technical skill is improved like that kind of post.
Graphic Designing Training in Chennai | Graphic Designing Training in Velachery | Graphic Designing Training in Keelkattalai | Graphic Designing Training in Taramani


ajay said...

Excellent information with unique content and it is very useful to know about the information based on blogs...
RPA Training Institute in Chennai | RPA Certification Training in Velachery | RPA Course in Taramani | RPA Training in Keelkattalai | RPA Training in Pallikaranai

roja said...

Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
Java Training in Chennai | Java Training in Adyar | Java Training in Velachery | Java Training in Madipakkam | Java Training in Tambaram | Java Training in Guindy

Jasmine said...

This is really too useful and have more ideas from yours. Keep sharing many techniques and thanks for sharing the information.
AWS Certification Center in Chennai | AWS Training in St.Thomas Mount | AWS Training in Porur | AWS Training in Chrompet | AWS Training in Pallavaram | AWS Training in Meenambakkam | AWS Training in Perungudi | AWS Training in Ashok Nagar | AWS Training in Besant Nagar | AWS Training in Nanganallur

Deepa said...

It's very great post... Really you are... done a wonderful job Keep up the good work and continue sharing like this.
Linux Training in Chennai | Linux Training in Velachery | Linux Training in Taramani | Linux Certification Course in Pallikaranai | Linux Course in Keelkattalai | Linux Certification Training in Saidapet

itsriya said...

Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating...
Best Microsoft Azure Training Institute in Chennai |Best Microsoft Azure Training Institute in Taramani

Deepa said...

Good Blog....Thanks for sharing your informative and amazing blog with us, its very helpful for everyone.
CCNA Training in Chennai | CCNA Training in Velachery | CCNA Course in Taramani | CCNA Certification Training in Pallikaranai | CCNA Training in Keelkattalai | CCNA Training in Pallavaram | CCNA Training in OMR

ramya said...

Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.
Selenium Training Institute in Chennai | Selenium Training in Velachery | Selenium Course in Taramani | Selenium Training in Madipakkam | Selenium Training in OMR | Selenium Certification Course in Adyar

ajay said...

Excellent information with unique content and it is very useful to know about the information based on blogs...
Tally Training Institute in Chennai | Tally Training in Velachery | Tally Training in Taramani | Tally Course in Guindy

Nancy said...

I have read your blog. It’s very informative and useful blog. You have done really great job. Keep update your blog.
No.1 RPA Training institute in Chennai | No.1 RPA Training institute in Velachery

Jasmine said...

All the points you described so beautiful. Every time i read your blog content and i so surprised that how you can write so well.
Android Training Institute in Chennai | Android Training in Taramani | Android Training in Velachery | Android Course in Keelkattalai | Android Training in Guindy

Dhanish said...

Interesting articles and this is my first first reading a very interesting article thanks for this article that fits with the theme news.
CCNA Training Institute in Chennai | CCNA Training Institute in Velachery

Muhammad Hassan said...

Excellent blog! I found it while surfing around on Google. Content of this page is unique as well as well researched. Appreciate it. IP Address

Deepa said...

This is really too useful and have more ideas from yours. Keep sharing many techniques and thanks for sharing the information.
Web Designing Training in Chennai | Web Designing Training in Velachery | Web Designing Training in Taramani | Web Designing Training in Perungudi | Web Designing Course in Pallikaranai | Web Designing Training in OMR

Unknown said...

Nice post. Great information and really very much useful
Best Paper Plates Shop in Chennai | Best Paper Plates Shop in Kovilambakkam

roja said...

Your blog is very informative with useful information, thanks a lot for sharing such a wonderful article, its very useful for me. Keep updating your creative knowledge....
Uipath Training Institute in Chennai | Uipath Training in Velachery | Uipath Training in Taramani | Uipath Certification Training in Pallikaranai | Uipath Training in Perungudi

ajay said...

I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.
Blue Training in Chennai | Blue Prism Certification Training in Velachery | Blue Prism Training in Saidapet | Blue Prism Course in Taramani | Blue Prism Training in OMR

mani said...

I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work.
Best Tally Course Training Institute in kanchipuram|

ramya said...

Very good and informative article. Thanks for sharing such nice article, keep on updating such good articles.
Matlab Training in Chennai | Matlab Training in Velachery | Matlab Training in Taramani | Matlab Training in Keelkattalai | Matlab Training in OMR | Matlab Training in Madipakkam

roja said...

Excellent information with unique content and it is very useful to know about the information based on blogs...
AWS Training Institute in Chennai | AWS Course in Velachery | AWS Training in Taramani | AWS Certification Training in Nanganallur

Karthik said...

Amazing article...Very useful for freshers..
Selenium Testing Course in Chennai | Selenium Testing Course in Nanganallur

ajay said...

Very interesting topic. Helps to gain knowledge about lot of information. Thanks for posting information in this blog.
Java Training in Chennai | Java Training in Velachery | Java Course in Taramani | Java Training in Nanganallur

ramya said...

Good Blog....Thanks for sharing your informative and amazing blog with us, its very helpful for everyone..
Linux Certification Training in Chennai | Linux Training in Velachery | Linux Course in Taramani | Linux Training in Chrompet | Linux Training in Pallavaram | Linux Training in OMR | Linux Training in Madipakkam

ajay said...

This is really too useful and have more ideas from yours. Keep sharing many techniques and thanks for sharing the information.
Selenium Training in Chennai | Selenium Automation Course in Velachery | Selenium Training in Chrompet | Selenium Training in Madipakkam

Unknown said...

Great post. Wonderful information and really very much useful. Thanks for sharing and keep updating.
Best Paper Plates Shop in Chennai | Best Paper Plates Shop in Kovilambakkam

roja said...

Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.
Manual Testing Course in Chennai | ISTQB Certification Center in Velachery | Software Testing Course in Taramani | ISTQB Certification Center in Chennai | ISTQB Training in Keelkattalai

Samla said...

This is really too useful and have more ideas from yours. keep sharing many techniques and thanks for sharing the information.
Graphic Designing Training in Chennai | Graphic Designing Training in Velachery

Jasmine said...

Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
Cloud Computing Training in Chennai | Cloud Computing Training in Velachery | Cloud Computing Training in Taramani | Cloud Computing Training in Keelkattalai

«Oldest ‹Older   401 – 436 of 436   Newer› Newest»

Post a Comment

Popular Posts