Block an IP address from connecting to a server

iptables -A INPUT -s 222.35.138.25/32 -j DROP
This appends (-A) a new rule to the INPUT chain, which specifies to drop all packets from a source (-s) IP address.

11
By: root
2009-02-02 12:42:04

What Others Think

exactly what I needed to get ridd of several IP addresses.
kille · 663 weeks and 1 day ago
I usually use "-I INPUT" rather than "-A INPUT" to ensure it's not allowed by something else first. Also is the /32 required?
pixelbeat · 662 weeks and 5 days ago
I'd really like to shut this off now that I've tested it. How might I go about that?
Tralce · 657 weeks and 3 days ago
Check first. iptables -vn -L INPUT Add rule. iptables -A INPUT -s 222.35.138.25/32 -j DROP Check that it's there. Remove rule. iptables -D INPUT -s 222.34.138.25/32 -j DROP And then check again that it's gone.
AJxn · 522 weeks ago
kitchen remodeling santa barbara Whoa! I just can't believe I found this site
yeoyeo · 48 weeks and 4 days ago
cant get over this. will recommend this to my friends. human hair extensions
looneyhans · 34 weeks and 6 days ago
Interesting and amazing how your post is! It Is Useful and helpful for me That I like it very much, and I am looking forward to Hearing from your next.. ?????
KayGasaway · 32 weeks and 2 days ago
Your post is very helpful to get some effective tips to reduce weight properly. You have shared various nice photos of the same. I would like to thank you for sharing these tips. Surely I will try this at home. Keep updating more simple tips like this. ????
KayGasaway · 31 weeks and 5 days ago
You have a real talent for writing unique content. I like how you think and the way you express your views in this article. I am impressed by your writing style a lot. Thanks for making my experience more beautiful. ???????
KayGasaway · 31 weeks and 1 day ago
Indiansmartpanel is the best and cheapest smm panel. The best social media marketing panel for resellers #1Top cheap smm panel
KayGasaway · 31 weeks ago
Recruitly is a cloud based Recruitment CRM and ATS system built to streamline agency recruitment processes and help businesses grow as a result. All the tools you need to run your recruitment business in one place. Visit our website to get more information. Thank You. Recruiting agency software
KayGasaway · 30 weeks and 6 days ago
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. ??? ???
KayGasaway · 30 weeks and 5 days ago
You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. Onewheel XR Accessories
KayGasaway · 29 weeks and 2 days ago
Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing Onewheel XR Accessories
KayGasaway · 28 weeks and 2 days ago
It turns out that even the hottest port has a few places where you can get off the beaten path. Here are some recommendations that will make you feel like you're in the know Computer Support and Services Beverlywoods Los Angeles, California
KayGasaway · 27 weeks and 5 days ago
All the best brands at one Place in Pakistan, Super Bazar online shopping karachi Best Deals available at discounted rates Cah on delivery Service in Karachi, Lahore, Rawalpindi, across Pakistan. Please visit our website for best online shopping experience. Thank You.
mohsinkhatri · 26 weeks and 3 days ago
Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! airparrot serial
hiknigarde · 26 weeks and 2 days ago
We have sell some products of different custom boxes.it is very useful and very low price please visits this site thanks and please share this post with your friends. mpo slot online
mohsinkhatri · 26 weeks and 2 days ago
Great goods from you, man. I have understand your stuff previous to and you are just extremely excellent. I actually like what you have acquired here, really like what you are stating and the way in which you say it. You make it entertaining and you still take care of to keep it smart. I can not wait to read far more from you. This is really a terrific site. ?????????????
coffman77 · 26 weeks and 1 day ago
Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. Do Follow backlink's
mohsinkhatri · 25 weeks and 5 days ago
Nice to read your article! I am looking forward to sharing your adventures and experiences. http://www.clubwww1.com/dating/member/blog_post_view.php?postId=99500">jungle boys weed
hiknigarde · 24 weeks and 6 days ago
Wow i can say that this is another great article as expected of this blog.Bookmarked this site.. North American Bancard Agent
hiknigarde · 21 weeks and 2 days ago
Contact us now & get instant Scrap car removal service in GTA west areas, Top Cash for Scrap Cars Ontario. cash for scrap cars
ayesha · 17 weeks and 2 days ago
No Deposit Casino Sites 2021 are quite a popular choice for players online, casino with no deposit is a very effective way to play online games without spending any capital start.
KayGasaway · 12 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Similar Commands

Block an IP address

Record output of any command using 'tee' at backend; mainly can be used to capture the output of ssh from client side while connecting to a server.

ssh: change directory while connecting

extract XML RSS etc by tags such as or <code> or <description></a></strong> </p> </div> <hr> <div class="box-copy"> <h3 class="righthead">Stay in the loop…</h3> <div class="toggleable"> <dl> <dt>Follow the Tweets.</dt> <dd> <a href="http://twitter.com/commandlinefu"><img class="link-img" src="/images/twitter.jpg" /></a> <p>Every new command is wrapped in a tweet and posted to <a href="http://twitter.com">Twitter</a>. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.</p> <p> » <a style="font-weight:bold;" href="http://twitter.com/commandlinefu">http://twitter.com/commandlinefu</a><br/> » <a style="font-weight:bold;" href="http://twitter.com/commandlinefu3">http://twitter.com/commandlinefu3</a><br/> » <a style="font-weight:bold;" href="http://twitter.com/commandlinefu10">http://twitter.com/commandlinefu10</a> </p> </dd> <dt>Subscribe to the feeds.</dt> <dd> <a style="font-weight:bold;" href="http://feeds2.feedburner.com/Command-line-fu"><img class="link-img" src="/images/rss.gif" /></a> <p>Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):</p> <p>Subscribe to the feed for:</p> <ul id="feed-links"> <li>» <a style="font-weight:bold;" href="http://feeds2.feedburner.com/Command-line-fu">all commands</a></li> <li>» <a style="font-weight:bold;" href="/feed/threeup">commands with 3 up-votes</a> (commandlinefu3)</li> <li>» <a style="font-weight:bold;" href="/feed/tenup">commands with 10 up-votes</a> (commandlinefu10)</li> </ul> </dd> </dl> </div> </div> <!-- <div class="box-copy"> <a class="visibility-toggle" id="box-copy-tags">Hide</a> <h3>Top Tags</h3> <div class="toggleable"><br> <a href="/commands/tagged/112/awk">awk</a>, <a href="/commands/tagged/34/bash">bash</a></li>, <a href="/commands/tagged/235/curl">curl</a>, <a href="/commands/tagged/123/find">find</a>, <a href="/commands/tagged/163/grep">grep</a>, <a href="/commands/tagged/64/linux">Linux</a>, <a href="/commands/tagged/110/sed">sed</a></li> </ul> </div> </div> <div class="box-copy"> <a class="visibility-toggle" id="box-copy-functions">Hide</a> <h3>Functions</h3> <div class="toggleable"> </div> </div> --> </div> </div> </div> <footer class="bs-footer" role="contentinfo" style="background-color:#F5F5F5;"> <div class="container"> <p style="padding-top:20px;">commandlinefu.com © 2018 <a href="https://www.danstools.com" target="_blank">Dan's Tools</a> | <a href="/site/faq">FAQs</a> | <a href="/site/api">API</a> | <a href="/site/widget">Widget</a> | <a href="/site/privacy">Privacy</a></p> </div> </footer> <!-- <div id="wrapper"> <div id="right-block"> </div> <div id="header"> <h4><a href="/commands/browse" title="commandlinefu.com - the greatest commands on the web"><img src="/images/header-logo.jpg" alt="commandlinefu.com" /></a></h4> <div id="nav"> <strong><a href="/commands/random" title="Lucky dip">Random</a></strong> | <strong><a href="/commands/browse/last-week/sort-by-votes" title="Piping host commands from the last 7 days">Hot this week</a></strong> | <strong><a href="/commands/browse/sort-by-votes" title="See the all-time greatest commands">All-time greats</a></strong> • <strong><a href="/site/faq"><abbr title="Frequently asked questions">FAQ</abbr></a></strong> | <strong><a href="/site/api"><abbr title="API documentation">API</abbr></a></strong> | <strong><a href="/site/widget"><abbr title="Javascript widget">Widget</abbr></a></strong> </div> <div id="search"> <form id="search-form" action="/search/handler" method="post" > <div id="search-container"> <img id="loading" src="/images/tag-loader.gif" style="display:none;float:right;margin: 5px 5px 0 0;" /> <input type="text" id="search-query" class="inactive" name="q" autocomplete="off" value="" placeholder="type here to grep the archive..." /> </div> </form> <div style="display:none" id="search-options"></div> </div> </div> <div id="left-block"> </div> <div id="footer"> <div class="advertising"> </div> </div> </div> --> <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script> $.noConflict(); if (typeof Prototype !== "undefined" && Prototype.BrowserFeatures.ElementExtensions) { var disablePrototypeJS = function (method, pluginsToDisable) { var handler = function (event) { event.target[method] = undefined; setTimeout(function () { delete event.target[method]; }, 0); }; pluginsToDisable.each(function (plugin) { jQuery(window).on(method + '.bs.' + plugin, handler); }); }, pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip', 'popover', 'tab','collect']; disablePrototypeJS('show', pluginsToDisable); disablePrototypeJS('hide', pluginsToDisable); } </script> <script> jQuery( document ).ready(function() { hljs.initHighlightingOnLoad(); hljs.configure({useBR: true}); jQuery('span.code').each(function(i, block) { hljs.highlightBlock(block); }); if (1==0 && window.canRunAds === true) { jQuery('#blocker').hide(); } else { jQuery('#blocker').show(); } }); </script> <script src="//netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> <script src="/js/ads.js"></script> </body> </html>