{"id":222,"date":"2009-10-16T02:54:25","date_gmt":"2009-10-16T06:54:25","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=222"},"modified":"2013-03-20T08:40:05","modified_gmt":"2013-03-20T12:40:05","slug":"to-blockallow-ip-using-iptables","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/to-blockallow-ip-using-iptables","title":{"rendered":"Howto: deny\/allow IP using iptables"},"content":{"rendered":"<p>How to block an IP using iptables?<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>iptables -A INPUT -s xx.xx.xx.xx -j DROP<\/strong><\/span><\/pre>\n<\/blockquote>\n<p>How to block an IP for a specific port:<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j DROP<\/strong><\/span><\/pre>\n<\/blockquote>\n<p>How to allow access to an IP?<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT<\/strong><\/span><\/pre>\n<\/blockquote>\n<p>How to allow access to an IP to a specific port using iptables?<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j ACCEPT<\/strong><\/span><\/pre>\n<\/blockquote>\n<p>where, xx.xx.xx.xx is the remote IP address and PORT is the port number you wish to allow\/deny access to.<\/p>\n<p>How to block a scanner on your server for example &#8220;w00tw00t.at.ISC.SANS&#8221; using iptables?<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"><strong>iptables -I INPUT -p tcp --dport 80 -m string --algo bm\u00a0 \\\r\n--string 'GET \/w00tw00t.at.ISC.SANS.' -j DROP<\/strong><\/span><\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>How to block an IP using iptables?<\/p>\n<p>iptables -A INPUT -s xx.xx.xx.xx -j DROP<\/p>\n<p>How to block an IP for a specific port:<\/p>\n<p>iptables -A INPUT -p tcp -s xx.xx.xx.xx &#8211;dport PORT -j DROP<\/p>\n<p>How to allow access to an IP?<\/p>\n<p>iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT<\/p>\n<p>How to allow access to an IP to a specific port using iptables?<\/p>\n<p>iptables -A INPUT -p tcp -s xx.xx.xx.xx &#8211;dport PORT -j ACCEPT<\/p>\n<p>where, xx.xx.xx.xx is the remote IP address and PORT is the port number you wish to allow\/deny access to.<br \/>\nHow to block a scanner on [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[618,614,613,616,615,617],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/222"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=222"}],"version-history":[{"count":7,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":224,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/222\/revisions\/224"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}