{"id":3521,"date":"2014-08-31T05:39:20","date_gmt":"2014-08-31T10:39:20","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=3521"},"modified":"2022-06-03T03:46:43","modified_gmt":"2022-06-03T08:46:43","slug":"blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/","title":{"rendered":"Iptables Block IP"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p><img decoding=\"async\" class=\"alignnone size-full wp-image-27638\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP.jpg\" alt=\"Iptables Block IP\" width=\"742\" height=\"371\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP.jpg 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP-150x75.jpg 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP-300x150.jpg 300w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/p>\n<p>Today we&#8217;ll show you how to block ip address using iptables. In the following article we are adding a blacklist to the firewall script which will allow you to block any abusive IP addresses or ranges of IPs in your <strong>Debian<\/strong> or <strong>Ubuntu<\/strong> based virtual server. Iptables is a user space application program that allows a system administrator to configure the tables provided by the Linux kernel firewall (<em>implemented as different Netfilter modules<\/em>) and the chains and rules it stores. Blocking an IP address using iptables is fairly easy task and it should take no more then 5 minutes.<\/p>\n<p><!--more--><\/p>\n<p>Before proceeding any further, make sure you read the tutorial on <a title=\"Securing your Ubuntu\/Debian based VPS using IPTABLES\/Netfilter firewall\" href=\"https:\/\/www.rosehosting.com\/blog\/securing-your-ubuntudebian-based-vps-using-iptablesnetfilter-firewall#\" target=\"_blank\" rel=\"noopener noreferrer\">how to secure\/design the firewall in your linux vps<\/a>. This includes:<\/p>\n<ul>\n<li>Flushing the old firewall rules<\/li>\n<li>Determining service ports<\/li>\n<li>Setting-up default policies<\/li>\n<li>Setting-up your firewall rules<\/li>\n<li>Saving your firewall rules<\/li>\n<\/ul>\n<h3>Block IP Using iptables<\/h3>\n<p>To block some abusive IP address or range of IPs, you can use the following <code>iptables<\/code> rules:<\/p>\n<pre>## iptables -I INPUT -s 1.2.3.4 -j DROP\r\n## iptables -I INPUT -s 1.2.0.0\/16 -j DROP<\/pre>\n<h3>Creating the Blacklist in iptables<\/h3>\n<p>For better readability and maintenance, it is a good idea to have all abusing IPs in one particular file, for example <code>\/etc\/blacklist.ips<\/code>. This way, you can add the IP addresses or subnets in this file (<i>one IP or subnet per line<\/i>) and use the <code>fwall-rules<\/code> script below to block anything listed in this file.<\/p>\n<p>So, create or edit <code>\/usr\/local\/bin\/fwall-rules<\/code> and make it as follows:<\/p>\n<pre>#!\/bin\/bash\r\n#\r\n# iptables firewall script\r\n# https:\/\/www.rosehosting.com\r\n#\r\n\r\nIPTABLES=\/sbin\/iptables\r\nBLACKLIST=\/etc\/blacklist.ips\r\n\r\necho \" * flushing old rules\"\r\n${IPTABLES} --flush\r\n${IPTABLES} --delete-chain\r\n${IPTABLES} --table nat --flush\r\n${IPTABLES} --table nat --delete-chain\r\n\r\necho \" * setting default policies\"\r\n${IPTABLES} -P INPUT DROP\r\n${IPTABLES} -P FORWARD DROP\r\n${IPTABLES} -P OUTPUT ACCEPT\r\n\r\necho \" * allowing loopback devices\"\r\n${IPTABLES} -A INPUT -i lo -j ACCEPT\r\n${IPTABLES} -A OUTPUT -o lo -j ACCEPT\r\n\r\n${IPTABLES} -A INPUT -p tcp ! --syn -m state --state NEW -j DROP\r\n${IPTABLES} -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\r\n\r\n## BLOCK ABUSING IPs HERE ##\r\n#echo \" * BLACKLIST\"\r\n#${IPTABLES} -A INPUT -s _ABUSIVE_IP_ -j DROP\r\n#${IPTABLES} -A INPUT -s _ABUSIVE_IP2_ -j DROP\r\n\r\necho \" * allowing ssh on port 5622\"\r\n${IPTABLES} -A INPUT -p tcp --dport 5622  -m state --state NEW -j ACCEPT\r\n\r\necho \" * allowing ftp on port 21\"\r\n${IPTABLES} -A INPUT -p tcp --dport 21  -m state --state NEW -j ACCEPT\r\n\r\necho \" * allowing dns on port 53 udp\"\r\n${IPTABLES} -A INPUT -p udp -m udp --dport 53 -j ACCEPT\r\n\r\necho \" * allowing dns on port 53 tcp\"\r\n${IPTABLES} -A INPUT -p tcp -m tcp --dport 53 -j ACCEPT\r\n\r\necho \" * allowing http on port 80\"\r\n${IPTABLES} -A INPUT -p tcp --dport 80  -m state --state NEW -j ACCEPT\r\n\r\necho \" * allowing https on port 443\"\r\n${IPTABLES} -A INPUT -p tcp --dport 443 -m state --state NEW -j ACCEPT\r\n\r\necho \" * allowing smtp on port 25\"\r\n${IPTABLES} -A INPUT -p tcp -m state --state NEW -m tcp --dport 25 -j ACCEPT\r\n\r\necho \" * allowing submission on port 587\"\r\n${IPTABLES} -A INPUT -p tcp -m state --state NEW -m tcp --dport 587 -j ACCEPT\r\n\r\necho \" * allowing imaps on port 993\"\r\n${IPTABLES} -A INPUT -p tcp -m state --state NEW -m tcp --dport 993 -j ACCEPT\r\n\r\necho \" * allowing pop3s on port 995\"\r\n${IPTABLES} -A INPUT -p tcp -m state --state NEW -m tcp --dport 995 -j ACCEPT\r\n\r\necho \" * allowing imap on port 143\"\r\n${IPTABLES} -A INPUT -p tcp -m state --state NEW -m tcp --dport 143 -j ACCEPT\r\n\r\necho \" * allowing pop3 on port 110\"\r\n${IPTABLES} -A INPUT -p tcp -m state --state NEW -m tcp --dport 110 -j ACCEPT\r\n\r\necho \" * allowing ping responses\"\r\n${IPTABLES} -A INPUT -p ICMP --icmp-type 8 -j ACCEPT\r\n\r\n# DROP everything else and Log it\r\n${IPTABLES} -A INPUT -j LOG\r\n${IPTABLES} -A INPUT -j DROP\r\n\r\n#\r\n# Block abusing IPs \r\n# from ${BLACKLIST}\r\n#\r\nif [[ -f \"${BLACKLIST}\" ]] &amp;&amp; [[ -s \"${BLACKLIST}\" ]]; then\r\n    echo \" * BLOCKING ABUSIVE IPs\"\r\n    while read IP; do\r\n        ${IPTABLES} -I INPUT -s \"${IP}\" -j DROP\r\n    done &lt; &lt;(cat \"${BLACKLIST}\")\r\nfi\r\n\r\n#\r\n# Save settings\r\n#\r\necho \" * SAVING RULES\"\r\n\r\nif [[ -d \/etc\/network\/if-pre-up.d ]]; then\r\n    if [[ ! -f \/etc\/network\/if-pre-up.d\/iptables ]]; then\r\n        echo -e \"#!\/bin\/bash\" &gt; \/etc\/network\/if-pre-up.d\/iptables\r\n        echo -e \"test -e \/etc\/iptables.rules &amp;&amp; iptables-restore -c \/etc\/iptables.rules\" &gt;&gt; \/etc\/network\/if-pre-up.d\/iptables\r\n        chmod +x \/etc\/network\/if-pre-up.d\/iptables\r\n    fi\r\nfi\r\n\r\niptables-save &gt; \/etc\/fwall.rules\r\niptables-restore -c \/etc\/fwall.rules<\/pre>\n<p>make sure the script is executable by adding an &#8216;x&#8217; bit to it:<\/p>\n<pre>## chmod +x \/usr\/local\/bin\/fwall-rules<\/pre>\n<h3>Applying the Rules<\/h3>\n<p>To apply the firewall rules and block the abusers, you need to just execute the <code>fwall-rules<\/code> script and that&#8217;s it.<\/p>\n<pre>## fwall-rules\r\n * flushing old rules\r\n * setting default policies\r\n * allowing loopback devices\r\n * allowing ssh on port 5622\r\n * allowing ftp on port 21\r\n * allowing dns on port 53 udp\r\n * allowing dns on port 53 tcp\r\n * allowing http on port 80\r\n * allowing https on port 443\r\n * allowing smtp on port 25\r\n * allowing submission on port 587\r\n * allowing imaps on port 993\r\n * allowing pop3s on port 995\r\n * allowing imap on port 143\r\n * allowing pop3 on port 110\r\n * allowing ping responses\r\n * BLOCKING ABUSIVE IPs\r\n * SAVING RULES<\/pre>\n<hr \/>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-27639\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/block-ip-iptables.jpg\" alt=\"Block IP with iptables\" width=\"150\" height=\"163\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/block-ip-iptables.jpg 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/block-ip-iptables-138x150.jpg 138w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/>Of course you don\u2019t have to block IP addresses using iptables, if you use one of our <a title=\"Linux VPS Hosting\" href=\"https:\/\/www.rosehosting.com\/managed-vps-hosting.html\" target=\"_blank\" rel=\"noopener noreferrer\">Linux VPS hosting<\/a> services, in which case you can simply ask our expert linux admins to block any IP address for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>PS.<\/strong> <\/span>If you liked this post on how to block IP addresses using iptables, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today we&#8217;ll show you how to block ip address using iptables. In the following article we are adding a blacklist &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Iptables Block IP\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/#more-3521\" aria-label=\"Read more about Iptables Block IP\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":27638,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1700,1701,1703,13,1698],"tags":[440,147,281],"class_list":["post-3521","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","category-networking-and-domains","category-security","category-tutorials","category-ubuntu","tag-blacklist","tag-firewall","tag-iptables","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Iptables Block IP | RoseHosting<\/title>\n<meta name=\"description\" content=\"Iptables Block IP | RoseHosting\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Iptables Block IP\" \/>\n<meta property=\"og:description\" content=\"Iptables Block IP | RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2014-08-31T10:39:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:46:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"371\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"Iptables Block IP\",\"datePublished\":\"2014-08-31T10:39:20+00:00\",\"dateModified\":\"2022-06-03T08:46:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/\"},\"wordCount\":355,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/08\\\/Iptables-Block-IP.jpg\",\"keywords\":[\"blacklist\",\"firewall\",\"iptables\"],\"articleSection\":[\"Debian\",\"Networking and Domains\",\"Security\",\"Tutorials\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/\",\"name\":\"Iptables Block IP | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/08\\\/Iptables-Block-IP.jpg\",\"datePublished\":\"2014-08-31T10:39:20+00:00\",\"dateModified\":\"2022-06-03T08:46:43+00:00\",\"description\":\"Iptables Block IP | RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/08\\\/Iptables-Block-IP.jpg\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/08\\\/Iptables-Block-IP.jpg\",\"width\":742,\"height\":371,\"caption\":\"Iptables Block IP\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Iptables Block IP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Iptables Block IP | RoseHosting","description":"Iptables Block IP | RoseHosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/","og_locale":"en_US","og_type":"article","og_title":"Iptables Block IP","og_description":"Iptables Block IP | RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2014-08-31T10:39:20+00:00","article_modified_time":"2022-06-03T08:46:43+00:00","og_image":[{"width":742,"height":371,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"Iptables Block IP","datePublished":"2014-08-31T10:39:20+00:00","dateModified":"2022-06-03T08:46:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/"},"wordCount":355,"commentCount":4,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP.jpg","keywords":["blacklist","firewall","iptables"],"articleSection":["Debian","Networking and Domains","Security","Tutorials","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/","url":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/","name":"Iptables Block IP | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP.jpg","datePublished":"2014-08-31T10:39:20+00:00","dateModified":"2022-06-03T08:46:43+00:00","description":"Iptables Block IP | RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2014\/08\/Iptables-Block-IP.jpg","width":742,"height":371,"caption":"Iptables Block IP"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/blocking-abusive-ip-addresses-using-iptables-firewall-in-debianubuntu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Iptables Block IP"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/3521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=3521"}],"version-history":[{"count":1,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/3521\/revisions"}],"predecessor-version":[{"id":42187,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/3521\/revisions\/42187"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/27638"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=3521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=3521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=3521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}