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

846 comments:

«Oldest   ‹Older   801 – 846 of 846   Newer›   Newest»
harry said...

I have read your blog. It’s very informative and useful blog. You have done really great job. Keep update your blog.

Gradhics Design Training in Chennai | Graphics Design Training in Velachery | Graphics Design Training in Guindy

SANDY P said...

Very good and informative article. Thanks for sharing such nice article, keep on updating such good articles.
VM Ware Training in Chennai | VM Ware Training in Velachery | VM Ware Training in Guindy

lathamukesh said...

The provided information’s are very useful to me.Thanks for sharing.Keep updating your blog.No:1 ORACLE Exam Center in Chennai

harry said...

Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
Microsoft Office Training in Chennai | Microsoft Office Training in Velachery | Microsoft Office Training in Adayar

lathamukesh said...

The provided information’s are very useful to me.Thanks for sharing.Keep updating your blog.No:1 ORACLE Exam Center in Chennai

SANDY P said...

I have read your blog. It’s very informative and useful blog. You have done really great job. Keep update your blog.
Server Administration Training in Chennai | Server Administration Training in Velachery | Server Administration Training in Adayar

Raja Rani said...

The provided information’s are very useful to me.Thanks for sharing.Keep updating your blog.No:1 Azure Certification in Chennai

harry said...

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

Saran said...

Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.
Best Certification MVC Training in Chennai | Best MVC Certification Training in Velacherry | Best MVC Certification Training in Tnagar

Raja Rani said...

The provided information’s are very useful to me.Thanks for sharing.Keep updating your blog.No:1 Azure Certification in Chennai

ajithrock said...

Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.
Best Certification MVC Training in Chennai | Best MVC Certification Training in Velacherry | Best MVC Certification Training in Tnagar

mythili s said...

Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it…
Android Project Center in Chennai

Saran said...

Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
Best VMware Training Center in Chennai | Best VMware Training Center in Velachery | Best VMware Training Center in Medavakkam

lathamukesh said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No:1 IEEE Project Center in Chennai

pooja said...

Great and useful article.Thanks for taking time to share

this post
Android Project Center in

Chennai

Rani Radha said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No:1 IEEE Project Center in Chennai

roja sangeetha said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No:1 Final Year Project Center in Chennai

Tuhin said...

keep up the good work. this is an Assam post. this to helpful, i have reading here all post. i am impressed. thank you. this is our digital marketing training center. This is an online certificate course
digital marketing training in bangalore / https://www.excelr.com/digital-marketing-training-in-bangalore

pooja ss said...

I am very happy after find this post and really helpful. Thanks for sharing this Informative content. Well explained. Got to learn new things from your Blog. your site really helps me for searching the new and great stuff.
ECE Project Center in Chennai

harry 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.
Adobe illustrator Course Training in Chennai | Adobe illustrator Course Training in Velachery | Adobe illustrator Course Training in Madippakam

roja sangeetha said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No:1 Final Year Project Center in Chennai

SANDY P said...

I have read your blog. It’s very informative and useful blog. You have done really great job. Keep update your blog.
VM ware Training in Chennai | VM ware Training in Velachery | VM ware Training in Madipakkam,

Garrick Co Ida said...

Great Article
Data Mining Projects


Python Training in Chennai

Project Centers in Chennai

Python Training in Chennai

Tuhin said...

keep up the good work. this is an Assam post. this to helpful, i have reading here all post. i am impressed. thank you. this is our digital marketing training center. This is an online certificate course
digital marketing training in bangalore | https://www.excelr.com/digital-marketing-training-in-bangalore

hanshika said...

Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
ECE Project Center in Chennai

lathamukesh said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No:1 Final Year Project Center in Chennai

ajithrock said...

very interesting topic.Helps to gain knowledge about lot of information. Thanks for posting information in this blog.
Python Certification Training in Chennai | Python Certification Training in Velachery | Python Certification Training in Guindy

Saran 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.
Basic Computer Courses in Chennai | Basic Computer Courses in Velacherry | Basic Computer Courses in Guindy

harry said...

I have read your blog. It’s very informative and useful blog. You have done really great job. Keep update your blog.
VM ware Training in Chennai | VM ware Training in Velachery | VM ware Training in Guindy

lathamukesh said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No:1 MATLAB Training centre in kanchipuram

reshmario 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.
Certified Ethical Hacking Training in Chennai | Certified Ethical Hacking Training in Velacherry | Certified Ethical Hacking Training in Ashok Nagar

Saran 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.
Automation Anywhere Training in Chennai | Automation Anywhere Training in Velacherry | Automation Anywhere Training in Ashok Nagar

harry 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 in Chennai | Android Training in Velachery | Android Training in Ashok nagar

SANDY P said...

I have read your blog. It’s very informative and useful blog. You have done really great job. Keep update your blog.

Gradhics Design Training in Chennai | Graphics Design Training in Velachery | Graphics Design Training in Ashok Nagar

Raja Rani said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No:1 Certified Ethical Hacking Training in kanchipuram

harry 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.
AWS Course Training in Chennai | AWS Course Training in Velachery | AWS Course Training in Besant nagar

Raja Rani said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No:1 Certified Ethical Hacking Training in kanchipuram

Saran said...

Your Blog is really awesome with useful and helpful content for us.Thanks for sharing ..keep updating more information.
Best CCNP Training in Chennai | Best CCNP Training in Velacherry | Best CCNP Training in Besant Nagar

Raja Rani said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No:1 Certified Ethical Hacking Training in kanchipuram

ajithrock said...

Your Blog is really awesome with useful and helpful content for us.Thanks for sharing ..keep updating more information.
Best CCNA Training Institute in Chennai | Best CCNA Training Institute in Velacherry | Best CCNA Training Institute in TNagar

mahi said...

Please refer below if you are looking for best Training center in coimbatore

Java Training in Coimbatore | Digital Marketing Training in Coimbatore | SEO Training in Coimbatore | Tally Training in Coimbatore | Python Training In Coimbatore | PMP Training In Coimbatore | Scrum Training In Coimbatore

Thank you for excellent article

roja sangeetha said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No : 1 CCNA project center in kanchipuram

ajithrock 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.
Certified Ethical Hacking Training in Chennai | Certified Ethical Hacking Training in Velacherry | Certified Ethical Hacking Training in Tambaram

harry 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.
Microsoft DotNet Training in Chennai | Microsoft DotNet Training in Velachery | Microsoft DotNet Training in Tambaram

Raja Rani said...

This is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.No : 1 Photoshop training center in kanchipuram

Saran said...

Nice blog.. Thanks for sharing informative blog.. its very useful to me.Thanks its Great Article... I love to read your articles because your writing style is too good, its is very very helpful for all of us.
SEO Training Institute in Chennai | SEO Training Institute in Velachery | SEO Training Institute in Tambaram

«Oldest ‹Older   801 – 846 of 846   Newer› Newest»

Post a Comment

Popular Posts