{"id":1285,"date":"2020-09-14T14:56:36","date_gmt":"2020-09-14T02:56:36","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1285"},"modified":"2020-09-14T15:10:29","modified_gmt":"2020-09-14T03:10:29","slug":"blocking-unblocking-ip-in-ubuntu","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1285","title":{"rendered":"Blocking\/Unblocking IP in Ubuntu"},"content":{"rendered":"<h1>Pre-requisite<\/h1>\n<p>Install the <strong>iptables-persistent<\/strong> package to <strong>automatically load saved iptables rules<\/strong>.<\/p>\n<pre style=\"white-space: pre;\">sudo apt-get install iptables-persistent<\/pre>\n<h1>Lists the rules in a chain or all chains<\/h1>\n<pre style=\"white-space: pre;\">sudo iptables -L [CHAIN]<\/pre>\n<blockquote><p>Where <strong>CHAIN<\/strong> sample value could be one of the following: INPUT, FORWARD or OUTPUT. If this is not provided all the chains will be listed.<\/p><\/blockquote>\n<h1>Blocking an IP Address<\/h1>\n<pre style=\"white-space: pre;\">sudo iptables -A INPUT -s &lt;IP_ADDR&gt; -j DROP\r\nsudo sh -c \"iptables-save &gt; \/etc\/iptables\/rules.v4\"<\/pre>\n<blockquote><p>Where <strong>IP_ADDR<\/strong> is the IP address to be blocked.<\/p><\/blockquote>\n<h1>Unblocking an IP Address<\/h1>\n<pre style=\"white-space: pre;\">sudo iptables -D INPUT -s &lt;IP_ADDR&gt; -j DROP\r\nsudo sh -c \"iptables-save &gt; \/etc\/iptables\/rules.v4\"<\/pre>\n<blockquote><p>Where <strong>IP_ADDR<\/strong> is the IP address to be unblocked if you use the <strong>preceding blocking procedure<\/strong>.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Pre-requisite Install the iptables-persistent package to automatically load saved iptables rules. sudo apt-get install iptables-persistent Lists the rules in a chain or all chains sudo iptables -L [CHAIN] Where CHAIN sample value could be one of the following: INPUT, FORWARD or OUTPUT. If this is not provided all the chains will be listed. Blocking an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[23,12],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1285"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1285"}],"version-history":[{"count":7,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1285\/revisions"}],"predecessor-version":[{"id":1292,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1285\/revisions\/1292"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}