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

1045 comments:

«Oldest   ‹Older   1001 – 1045 of 1045   Newer›   Newest»
ajithrock said...

Very interesting content which helps me to get the in depth knowledge about the technology.
Mobile Apps Training Institute in Chennai | Mobile Apps Training Institute in Velachery | Mobile Apps Training Institute in Saidapet


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.
Microsoft Certification Training in Chennai | Microsoft Certification Training in Velacherry | Microsoft Certification Training in Saidapet

seelan said...

Excellent post with all required information and admirable stories. Anticipating for your future posts. Keep up the Good work.

Best Embedded Systems Training Institute in Chennai |Best Embedded Systems Training Institute in Keelkattalai


Saran said...

Very good and informative article. Thanks for sharing such nice article, keep on updating such good articles.
Bootstrap Training Institute in Chennai | Bootstrap Training Institute in Velachery | Bootstrap Training Institue in Tambaram | Bootstrap Training Institue in Guindy

elearnoak said...


Thanks for your post! Through your pen I found the problem up interesting! I believe there are many other people who are interested in them just like me! Thanks your shared!... I hope you will continue to have similar posts to share with everyone! I believe a lot of people will be surprised to read this article! Best DevOps online training in hyderabad


Dhanish said...

Good content and thanks for giving nice information to read your blog.
Graphic Designing Training Institute in Chennai | Graphic Design Certification Course in Adyar

vijay said...

Excellent, Healthy and Creative content with more information required for IT and Non-IT professionals. I am looking forward for your future posts. Keep up the Good work.

Best SEO Training in Chennai | Best SEO Training in Adyar

seelan said...

Excellent, Healthy and Creative content with more information required for IT and Non-IT professionals. I am looking forward for your future posts. Keep up the Good work.

Best MBA Project Center in Chennai | Best MBA Project Center in Tambaram


Saran 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.!...
Blueprism Training Course in Chennai | Blueprism Training Course in Velachery | Blueprism Training Course in Tambaram

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.
Uipath Robotics Process Automation in Chennai | Uipath Robotics Process Automation in Velacherry | Uipath Robotics Process Automation in Tambaram

reshmario said...

Your Blog is really awesome with useful and helpful content for us.Thanks for sharing ..keep updating more information.
QA Training Training in Chennai | QA Testing Training in Tambaram | QA Testing Training in Velachery | QA Testing Training in Guindy

Saran said...

This blog very easily understandable. Thanks for sharing such an informative post with us.This is a nice post in an interesting line of content.
Tally Training Course in Chennai | Tally Training Course in Velcherry | Tally Training Course in Pallikaranai

seelan said...

Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.

Best MATLAB Training in Chennai | Best MATLAB Training in Velachery


reshmario said...

Very informative blog. Thanks for sharing such good information and keep on updating.This is a nice post in an interesting line of content.Thanks for sharing this article.
PCB Training in Chennai | PCB Training in Velcherry | PCB Training in Guindy

ajithrock said...

I have read your blog its very attractive and impressive. I like it your blog...
Web Design And Development Training in Chennai | Web Design And Development Training in Velcherry | Web Design And Development Training in Taramani

sindhu sree said...

Wonderful article.It is to define the concepts very well.Clearly explain the information.It has more valuable information for

encourage me to achieve my career goal.

Best Android Training institute in kanchipuram

sindhu sree said...

Wonderful article.It is to define the concepts very well.Clearly explain the information.It has more valuable information for encourage me to achieve my career goal.

Best Android Training institute in kanchipuram

akhilpatel said...

Thanks for your post! Through your pen I found the problem up interesting! I believe there are many other people who are interested in them just like me! Thanks your shared!... I hope you will continue to have similar posts to share with everyone! I believe a lot of people will be surprised to read this article! DevOps online training in hyderabad

ajithrock said...

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.
PHP and MYSQL Training Course in Chennai | PHP and MYSQL Training Course in Velcherry | PHP and MYSQL Training Course in OMR

Saran said...

Very informative blog. Thanks for sharing such good information and keep on updating.This is a nice post in an interesting line of content.Thanks for sharing this article.
VLSI Training in Chennai | VLSI Training in Velcherry | VLSI Training in OMR

reshmario said...

It's very great post...Thanks for sharing such an informative post..
Thanks for sharing this valuable information.. I saw your website and get more details..Nice work...
HP and QTP Training Course in Chennai | HP and QTP Training Course in Velcherry | HP and QTP Training Course in Pallavaram

Priyanka said...

Attend The Digital Marketing Course Bangalore From ExcelR. Practical Digital Marketing Course Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Digital Marketing Course Bangalore.
Digital Marketing Course Bangalore

vijay said...


Very Informative...Glad to find your blog...Keep Sharing...

Java Script Course in Chennai | Java Script Course in Medavakkam


Priyanka said...

Attend The Machine Learning course Bangalore From ExcelR. Practical Machine Learning course Bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Machine Learning course Bangalore.
Machine Learning course Bangalore

uma said...



Thank you for your information. I have got some important suggestions from it. Keep on sharing.
Best Computer Service in Chennai | Best Computer Service in Kovilambakkam

madhu said...

You have provided a nice article, Thank you very much for this one. And I hope this will be useful for many people. And I am waiting for your next post keep on updating these kinds of knowledgeable things
Android Training in Chennai
Android Course in Chennai
App Development Course in Chennai
Android Development Course in Chennai
Android App Development Course in Chennai

madhu said...

You have provided a nice article, Thank you very much for this one. And I hope this will be useful for many people. And I am waiting for your next post keep on updating these kinds of knowledgeable things
App Development Course in Chennai
Android Development Course in Chennai
Android Training Institutes in Bangalore
Android App Development Course in Bangalore
Android Course in Coimbatore
Android App Development Course in Coimbatore
Android Course in Madurai

uma said...



Thank you for your information. I have got some important suggestions from it. Keep on sharing.
Best Computer Service in Chennai | Best Computer Service in Kovilambakkam

niva said...

very nyc..
coronavirus update
inplant training in chennai
inplant training
inplant training in chennai for cse
inplant training in chennai for ece
inplant training in chennai for eee
inplant training in chennai for mechanical
internship in chennai
online internships

Arunvijay said...

Technical knowlege developement...
Coronavirus Update
Intern Ship In Chennai
Inplant Training In Chennai
Internship For CSE Students
Online Internships
Internship For MBA Students
ITO Internship

Neha Bora said...

When I am searching for different sort of information, at that time I found yours blog. online Linux training

datasciencecourse said...

I am looking for and I love to post a comment that "The content of your post is awesome" Great work!

Digital marketing courses in Bangalore

Remote Devops Jobs said...

I have bookmarked your website because this site contains valuable information in it. I am really happy with articles quality and presentation.
Thanks a lot for keeping great stuff. I am very much thankful for this site.

latchu kannan said...

Very good informative blog, keep sharing.
BEST ANGULAR JS TRAINING IN CHENNAI WITH PLACEMENT

https://www.acte.in/angular-js-training-in-chennai
https://www.acte.in/angular-js-training-in-annanagar
https://www.acte.in/angular-js-training-in-omr
https://www.acte.in/angular-js-training-in-porur
https://www.acte.in/angular-js-training-in-tambaram
https://www.acte.in/angular-js-training-in-velachery

Quadsel Systems said...

Pretty article! I found some useful information in your blog....

so here we provide,

We provide you with flexible services and complete hybrid network solutions. It can provide your organisation with exceptional data speeds, advanced external security protection, and high-resilience by leveraging the latest SD-WAN and networking technologies to monitor, manage and strengthening your organisation’s existing network devices.

https://www.quadsel.in/networking/>
https://twitter.com/quadsel/
https://www.linkedin.com/company/quadsel-systems-private-limited/
https://www.facebook.com/quadselsystems/

#quadsel #network #security #technologies #managedservices #Infrastructure #Networking #OnsiteResources #ServiceDeskSupport #StorageServices #WarrantyAMCServices #datacentersolutions #DataCenterBuild #EWaste #InfraConsolidation #DisasterRecovery #NetworkingServices #ImagingServices #MPS #Consulting #WANOptimisation #enduserservices

Bluebase said...

Bring your Organisation Brand into the Digital World, to know more contact us

www.bluebase.in
https://www.facebook.com/bluebasesoftware/
https://www.linkedin.com/…/bluebase-software-services-pvt-…/
https://twitter.com/BluebaseL/
#applications #EnterpriseSolutions #CloudApplication #HostingServices #MobileAppDevelopment #Testing #QA #UIdesign #DigitalMarketing #SocialMediaOptimisation #SMO #SocialMediaMarketing #SMM #SearchEngineOptimisation #SEO #SearchEngineMarketing #SEM #WebsiteDevelopment #WebsiteDesigning #WebsiteRevamping #crm #erp #custombuildapplication #android #ios

Priyanka said...

Attend The Artificial Intelligence course From ExcelR. Practical Artificial Intelligence course Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Artificial Intelligence course.
Artificial Intelligence Course

deiva said...

Really nice post. Thank you for sharing amazing information.
Digital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery

Priyanka said...

Attend The Bangalore Digital Marketing Course From ExcelR. Practical Bangalore Digital Marketing Course Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Bangalore Digital Marketing Course.
Bangalore Digital Marketing Course

Saravanan said...

Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
CCNA Training Institute in Chennai | CCNA Training Institute in Velachery

Joyal said...

Thanks for the well-written post and I will follow your updates regularly and this is really helpful. Keep posting more like this.
Oracle Training | Online Course | Certification in chennai | Oracle Training | Online Course | Certification in bangalore | Oracle Training | Online Course | Certification in hyderabad | Oracle Training | Online Course | Certification in pune | Oracle Training | Online Course | Certification in coimbatore

varsha said...

I do agree your blog for quiz programming concepts, which is very helpful to grow up your knowledge. keep sharing more
AWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery

Radley Co Tad said...

IEEE Cloud computing DOamin is a general term for anything that involves delivering hosted services over the Internet. cloud computing projects The cloud projects for cse is a metaphor for a global network of remote servers which operates as a single ecosystem, commonly associated with the Internet. IEEE FInal Year Networking Projects for CSE Domains Networking Projects cloud computing is the delivery of computing projects services—including servers, storage, databases, networking projects, software, analytics, and intelligence


JavaScript Training in Chennai


JavaScript Training in Chennai

uma said...

Awesome blog. Your articles really impressed for me, because of all information so nice and unique...
Best Paper Plates Shop in Chennai | Best Paper Plates Shop in thirukkalukundram

mary Brown said...

Great Article
Cloud Computing Projects


Networking Projects

Final Year Projects for CSE


JavaScript Training in Chennai

JavaScript Training in Chennai

The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

«Oldest ‹Older   1001 – 1045 of 1045   Newer› Newest»

Post a Comment

Popular Posts