{"id":23227,"date":"2020-12-09T10:13:21","date_gmt":"2020-12-09T02:13:21","guid":{"rendered":"https:\/\/web.mwwsb.com.my\/pjci\/?post_type=kb&#038;p=23227"},"modified":"2022-09-08T20:00:14","modified_gmt":"2022-09-08T12:00:14","slug":"how-to-check-if-ip-is-blocked-from-iptables-2","status":"publish","type":"kb","link":"https:\/\/www.casbay.com\/guide\/kb\/how-to-check-if-ip-is-blocked-from-iptables-2","title":{"rendered":"HOW TO: Check if IP is blocked from IPtables"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"23227\" class=\"elementor elementor-23227\" data-elementor-post-type=\"kb\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-24b92fe elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"24b92fe\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4ded9ed\" data-id=\"4ded9ed\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-bf77742 elementor-widget elementor-widget-heading\" data-id=\"bf77742\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">HOW TO: Check if IP is blocked from IPtables<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3f22323 elementor-widget elementor-widget-image\" data-id=\"3f22323\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/casbay.com\/guide\/wp-content\/uploads\/2021\/02\/iptable.png\" title=\"\" alt=\"\" loading=\"lazy\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b2b64f4 elementor-widget elementor-widget-text-editor\" data-id=\"b2b64f4\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Checking if an IP is blocked in IPTABLES<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3d8f318 elementor-widget elementor-widget-text-editor\" data-id=\"3d8f318\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p><strong>Iptables<\/strong> is a program that utilizes policy chains to <strong>configure the IP packet filter rules<\/strong> of Linux kernel firewall in order to allow or block traffic. For instance,\u00a0this firewall can be installed to your Linux <a href=\"https:\/\/www.casbay.com\/asia-dedicated-server\">Dedicated<\/a> or <a href=\"https:\/\/www.casbay.com\/vps-hosting-malaysia\">Virtual Server<\/a>\u00a0to secure your server workloads. Let&#8217;s say if a user attempts to SSH into your server, <strong>iptables\u00a0<\/strong>will try to match the IP address and port to a rule in the input chain.\u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8a3a978 elementor-widget elementor-widget-text-editor\" data-id=\"8a3a978\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p><strong>Check if IP is blocked:<\/strong><\/p><p>iptables -L -n \u2013line | grep [IP Address]<\/p><p>If IP appear as DROP or REJECT, the IP in the IPTable has been blocked<\/p><p>Therefore, you would need to <strong>unblock<\/strong> the IP Address:<\/p><p>iptables -I INPUT -s [IP Address] -j ACCEPT<\/p><p>And this is how to block back an IP Address:<\/p><p>iptables -A INPUT -d [IP Address] -j DROP<\/p><p>service iptables save<\/p><p>===============================================================<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-1cf9328 elementor-widget elementor-widget-heading\" data-id=\"1cf9328\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-medium\">To unblock an IP from the CSF from SSH, please follow the steps below:<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d14f8f6 elementor-widget elementor-widget-text-editor\" data-id=\"d14f8f6\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Step <strong>1<\/strong> of 3<\/p><p>Firstly, to check if the CSF has blocked the IP, please execute the following command:<\/p><p>csf -g IP_address<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e1f167d elementor-widget elementor-widget-text-editor\" data-id=\"e1f167d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Note: IP_address being the specific IP you wish to check.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-64e489c elementor-widget elementor-widget-text-editor\" data-id=\"64e489c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Step\u00a0<strong>2<\/strong> of 3<\/p><p>Secondly, if the IP is denied and you wish to remove it, please execute the following command:<\/p><p>csf -dr IP_address<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7b52b74 elementor-widget elementor-widget-text-editor\" data-id=\"7b52b74\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Step <strong>3<\/strong> of 3<\/p><p>Lastly, to complete the process, you will need to restart CSF for the changes to take effect:<\/p><p>csf -r<\/p><p>==============================================================<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-93d2a67 elementor-widget elementor-widget-text-editor\" data-id=\"93d2a67\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Note: The ull path to IPTABLES is \/sbin\/iptables, but you can replace command # iptables with \/sbin\/iptables<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0eef6f0 elementor-widget elementor-widget-text-editor\" data-id=\"0eef6f0\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Click to read-&gt; <a href=\"https:\/\/www.casbay.com\/guide\/kb\/how-to-block-all-ports-in-iptables\/\"><em>HOW TO: Block all ports in IPtables<\/em><\/a><\/p><p>Also, you can visit our <a href=\"https:\/\/www.casbay.com\/guide\/\">Knowledge Base<\/a> to look for other articles.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>HOW TO: Check if IP is blocked from IPtables Checking if an IP is blocked in IPTABLES Iptables is a program that utilizes policy chains to configure the IP packet filter rules of Linux kernel firewall in order to allow or block traffic. For instance,\u00a0this firewall can be installed to your Linux Dedicated or Virtual [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}}},"kbtopic":[113],"kbtag":[106],"mkb_version":[],"_links":{"self":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/23227"}],"collection":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/comments?post=23227"}],"version-history":[{"count":12,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/23227\/revisions"}],"predecessor-version":[{"id":36621,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kb\/23227\/revisions\/36621"}],"wp:attachment":[{"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/media?parent=23227"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=23227"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/kbtag?post=23227"},{"taxonomy":"mkb_version","embeddable":true,"href":"https:\/\/www.casbay.com\/guide\/wp-json\/wp\/v2\/mkb_version?post=23227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}