{"id":324,"date":"2024-03-08T15:55:48","date_gmt":"2024-03-08T15:55:48","guid":{"rendered":"https:\/\/www.vpsjungle.in\/tutorials\/?p=324"},"modified":"2024-03-08T16:38:28","modified_gmt":"2024-03-08T16:38:28","slug":"linux-common-firewall-rules-and-command","status":"publish","type":"post","link":"https:\/\/www.vpsjungle.in\/tutorials\/linux-common-firewall-rules-and-command\/","title":{"rendered":"Linux Common Firewall Rules and Commands in iptables"},"content":{"rendered":"\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#what-is-firewall\">What is firewall ?<\/a><\/li><li><a href=\"#tables-in-ip-tables\">Tables in IPTables<\/a><\/li><li><a href=\"#chains-in-ip-tables\">Chains in IPTables<\/a><\/li><li><a href=\"#rules-in-ip-tables\">Rules in IPTables<\/a><\/li><li><a href=\"#lets-get-started-with-some-common-firewall-rules-and-commands-in-iptables\">Let\u2019s get started with some common firewall rules and commands in iptables.<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<p>If you are using Computers for while, you must be familiar with the word \u201cFirewall\u201d. We know that things do seem complex from the surface but through this tutorial, we are going to explain the basis of IPTable and the use of basic commands so that even if you are a networking student or want to deep dive into networks, you can benefit from this guide.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-firewall\">What is firewall ?<\/h2>\n\n\n\n<p>A firewall is a network security device that monitors incoming and outgoing network traffic and decides whether to allow or block specific traffic based on a defined set of security rules.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2019\/04\/iptables.jpg\" alt=\"Firewall Rules\" class=\"wp-image-1557\"\/><\/figure>\n<\/div>\n\n\n<p>Here we are going to show you some\u00a0<a href=\"https:\/\/www.vpsjungle.in\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/www.vpsjungle.in\/\" rel=\"noreferrer noopener\">lin<\/a><a href=\"https:\/\/www.vpsjungle.in\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/www.vpsjungle.in\/\" rel=\"noreferrer noopener nofollow\">u<\/a><a href=\"https:\/\/www.vpsjungle.in\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/www.vpsjungle.in\/\" rel=\"noreferrer noopener\">x<\/a> common firewall rules and commands in iptables. Iptables is a useful command line utility for configuring Linux kernel firewall. Iptables contains five tables: raw, filter, nat, mangle and security. Each table consist of chains. A chain is a list of firewall rules which are followed in order.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"tables-in-ip-tables\">Tables in IPTables<\/h2>\n\n\n\n<p>There are 5 types of <strong>tables<\/strong> in IPTables and each has different rules applied. So let\u2019s start with the most common table \u201c<strong>Filer<\/strong>\u201d.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Filter Table<\/strong> \u2013 This is the default and main table while using <strong>IPTables<\/strong>. It means whenever you won\u2019t mention any specific table while applying rules, they will be applied to the filter table. As its name suggests, the role of the Filter table is to decide whether the packages should be allowed to reach their destination or deny their request.<\/li>\n\n\n\n<li><strong>NAT (Network Address Translation)<\/strong> \u2013 As its name suggests, this table allows users to determine the translation of network addresses. The role of this table is to determine whether to modify and how to modify the source and destination of the packet address.<\/li>\n\n\n\n<li><strong>Mangle Table<\/strong> \u2013 This table allows us to modify the IP headers of packets. For example, you can adjust <strong>TTL<\/strong> to either lengthening or shorting network hops that the packet can sustain. Similarly, other IP headers can also be modified according to your preference.<\/li>\n\n\n\n<li><strong>RAW Table<\/strong> \u2013 The main use of this table is to track connections as it provides a mechanism for marking packets to view packets as a part of an ongoing session.<\/li>\n\n\n\n<li><strong>Security Table<\/strong> \u2013 Using the Security table, users can apply internal <strong>SELinux<\/strong> security context marks on network packets.<\/li>\n<\/ol>\n\n\n\n<p>For the most use cases, the last 2 types (<strong>RAW<\/strong> and <strong>Security<\/strong>) of the table don\u2019t have much to do and only the first 3 options are counted as main tables.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"chains-in-ip-tables\">Chains in IPTables<\/h2>\n\n\n\n<p>They behave at points in the route of the network where we can apply rules. In IPTables, we 5 types of <strong>chains<\/strong> and we will discuss each of them. Keep in mind that not each type of chain is available for each type of table.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Pre-routing<\/strong> \u2013 This chain is applied to any incoming packet once it is entered the network stack and this chain is processed even before any routing decision has been made regarding the final destination of the packet.<\/li>\n\n\n\n<li><strong>Input Chain<\/strong> \u2013 It is the point where a packet enters the network stack.<\/li>\n\n\n\n<li><strong>Forward Chain<\/strong> \u2013 It is the point where the packet has been forwarded through your system.<\/li>\n\n\n\n<li><strong>Output Chain<\/strong> \u2013 The output chain is applied to the packet when it originated through your system and goes out.<\/li>\n\n\n\n<li><strong>Post-routing<\/strong> \u2013 This is the complete opposite of the pre-routing chain and is applied to forwarded or outgoing packets once the routing decision has been made.<\/li>\n<\/ol>\n\n\n\n<p>Now, the only thing left to discuss is <strong>rules<\/strong>, and it\u2019s the easiest one out of the 3 that we have discussed here. So let\u2019s complete what\u2019s left on the theoretical part.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"rules-in-ip-tables\">Rules in IPTables<\/h2>\n\n\n\n<p><strong>Rules<\/strong> are nothing but the set or individual commands by which users manipulate network traffic. Once each chain will come into action, the packet will be checked against defined rules.<\/p>\n\n\n\n<p>If one rule does not satisfy the condition, it will be skipped to the next one and if it satisfies the condition, the next rule will be specified by the value of the target.<\/p>\n\n\n\n<p>each rule has two components: the <strong>matching component<\/strong> and the <strong>target component<\/strong>.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Matching Component<\/strong> \u2013 They are different conditions to define rules which can be matched by protocol, IP address, port address, interfaces, and headers.<\/li>\n\n\n\n<li><strong>Target Component<\/strong> \u2013 This is an action that will be triggered once the conditions are satisfied.<\/li>\n<\/ol>\n\n\n\n<p>This was the explanation part and now we will be covering basic commands related to <strong>IPTables<\/strong> in Linux.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"lets-get-started-with-some-common-firewall-rules-and-commands-in-iptables\">Let\u2019s get started with some common firewall rules and commands in iptables.<\/h2>\n\n\n\n<p>Log in to your Server via SSH as user root<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1021\" height=\"157\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image.png\" alt=\"\" class=\"wp-image-329\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image.png 1021w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-300x46.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-768x118.png 768w\" sizes=\"auto, (max-width: 1021px) 100vw, 1021px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"88\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-1.png\" alt=\"\" class=\"wp-image-331\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-1.png 1020w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-1-300x26.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-1-768x66.png 768w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/figure>\n\n\n\n<p>Installing iptables is very easy. If you have an Ubuntu or a Debian , run the following commands:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"155\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-2-1024x155.png\" alt=\"\" class=\"wp-image-332\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-2-1024x155.png 1024w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-2-300x45.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-2-768x116.png 768w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-2.png 1027w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If there is CentOS installed on your\u00a0server, run the following commands:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"146\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-3-1024x146.png\" alt=\"\" class=\"wp-image-333\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-3-1024x146.png 1024w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-3-300x43.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-3-768x110.png 768w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-3.png 1031w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>That\u2019s it, now you should have successfully installed iptables on your server.<\/p>\n\n\n\n<p><strong>Now, Lets see the common firewall rules in iptables<\/strong><\/p>\n\n\n\n<p>Listed below are examples about common firewall rules.<br>Accept all ESTABLISHED and RELATED packets:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"90\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-4-1024x90.png\" alt=\"\" class=\"wp-image-334\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-4-1024x90.png 1024w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-4-300x26.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-4-768x67.png 768w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-4.png 1027w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Allow HTTP and HTTPS connections from anywhere:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"125\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-5-1024x125.png\" alt=\"\" class=\"wp-image-335\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-5-1024x125.png 1024w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-5-300x37.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-5-768x94.png 768w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-5.png 1031w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Allow access on port 21 from a specific IP address only (e.g. 192.168.2.54) and block access from all other IPs to the server (e.g. server IP 192.168.2.100) :<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"157\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-6-1024x157.png\" alt=\"\" class=\"wp-image-336\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-6-1024x157.png 1024w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-6-300x46.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-6-768x118.png 768w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-6.png 1026w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Block an IP address (e.g. 192.168.2.74):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1023\" height=\"91\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-7.png\" alt=\"\" class=\"wp-image-337\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-7.png 1023w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-7-300x27.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-7-768x68.png 768w\" sizes=\"auto, (max-width: 1023px) 100vw, 1023px\" \/><\/figure>\n\n\n\n<p>Block an IP range and reject all packets (e.g. 192.168.2.0\/24):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"97\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-8-1024x97.png\" alt=\"\" class=\"wp-image-338\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-8-1024x97.png 1024w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-8-300x28.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-8-768x73.png 768w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-8.png 1027w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>To block outgoing traffic to a port, (e.g. port 123), use:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1017\" height=\"87\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-9.png\" alt=\"\" class=\"wp-image-339\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-9.png 1017w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-9-300x26.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-9-768x66.png 768w\" sizes=\"auto, (max-width: 1017px) 100vw, 1017px\" \/><\/figure>\n\n\n\n<p><strong>Common iptables commands<\/strong><\/p>\n\n\n\n<p>List all rules in all chains in verbose mode and display the IP addresses and port numbers instead host names and services, including the interface name, the rule options (if any), and the TOS masks:<\/p>\n\n\n\n<p><img decoding=\"async\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAA\/MAAABaCAYAAAD0BwYYAAARe0lEQVR4Xu3dZYxd1d4H4IW7BStBioZQJLhb8ADBAoECQQsluENwiruUEJIiIUCB4Cnu7u4EC+7Fitv7\/nbuPnc6dG5npmVm9r3P\/kJoz9l7nWetfvgt+e8JRo4c+VdxESBAgAABAgQIECBAgAABAo0RmECYb0xfaSgBAgQIECBAgAABAgQIEKgEhHkDgQABAgQIECBAgAABAgQINExAmG9Yh2kuAQIECBAgQIAAAQIECBAQ5o0BAgQIECBAgAABAgQIECDQMAFhvmEdprkECBAgQIAAAQIECBAgQECYNwYIECBAgAABAgQIECBAgEDDBIT5hnWY5hIgQIAAAQIECBAgQIAAAWHeGCBAgAABAgQIECBAgAABAg0TEOYb1mGaS4AAAQIECBAgQIAAAQIEhHljgAABAgQIECBAgAABAgQINExAmG9Yh2kuAQIECBAgQIAAAQIECBAQ5o0BAgQIECBAgAABAgQIECDQMAFhvmEdprkECBAgQIAAAQIECBAgQECYNwYIECBAgAABAgQIECBAgEDDBIT5hnWY5hIgQIAAAQIECBAgQIAAAWHeGCBAgAABAgQIECBAgAABAg0TEOYb1mGaS4AAAQIECBAgQIAAAQIEhHljgAABAgQIECBAgAABAgQINExAmG9Yh2kuAQIECBAgQIAAAQIECBAQ5o0BAgQIECBAgAABAgQIECDQMAFhvmEdprkECBAgQIAAAQIECBAgQECYNwYIECBAgAABAgQIECBAgEDDBIT5hnWY5hIgQIAAAQIECBAgQIAAAWHeGCBAgAABAgQIECBAgAABAg0TEOYb1mGaS4AAAQIECBAgQIAAAQIEhHljgAABAgQIECBAgAABAgQINExAmG9Yh2kuAQIECBAgQIAAAQIECBAQ5o0BAgQIECBAgAABAgQIECDQMAFhvmEdprkECBAgQIAAAQIECBAgQECYNwYIECBAgAABAgQIECBAgEDDBIT5hnWY5hIgQIAAAQIECBAgQIAAAWHeGCBAgAABAgQIECBAgAABAg0TEOYb1mGaS4AAAQIECBAgQIAAAQIEhHljgAABAgQIECBAgAABAgQINExAmG9Yh2kuAQIECBAgQIAAAQIECBAQ5o0BAgQIECBAgAABAgQIECDQMAFhvmEdprkECBAgQIAAAQIECBAgQECYNwYIECBAgAABAgQIECBAgEDDBIT5hnWY5hIgQIAAAQIECBAgQIAAAWHeGBhvAg899FAZPnx4GTJkSJl55pnH233diAABAgQIECBAgAABAgRGF+jVMH\/NNdeUG264oay00kpl8ODBZeKJJ+6V\/jnjjDPKiy++WA455JAyYMCA\/9iGBNahQ4eWTTfdtAwcOLBX2vtPPrT+fcstt1w54IADuvSozoT5\/3a\/LoH5MAECBAgQIECAAAECBLop0KthftiwYeXuu+8uyyyzTNl33327FebfeOONcvbZZ5e99tprrEG8IyNh\/t8ywnw3\/yX5GgECBAgQIECAAAECBHpQoFfD\/F9\/\/VW+++67Ms0005QJJ5ywWz874fPCCy\/s1Kq6MD92YmF+7EY+QYAAAQIECBAgQIAAgd4W6NUwPz5+\/JVXXlluv\/12YX58YP7\/PYT58QTpNgQIECBAgAABAgQIEPgHBXo1zI\/p\/HTC+cMPP1yOPvro8sILL5Rrr722fP3112Xqqacu6623XnVWfZJJJilvvfVWOeecc8rnn39essJfXzPOOGOrANuoUaPKiBEjyv3331\/dI99bdNFFy6BBg8pMM83U+k69zX6\/\/fYrr7\/+ernzzjtLvjvDDDOUzTffvKy55pqtnQMdnfn+9NNPy1VXXVWefvrp8uuvv1btXWeddar2TjbZZK1nPf\/88yW\/8b333qv+rH\/\/\/mXLLbcsSyyxRJlgggm61NW11eGHH14efPDBVrunm266stVWW5U11lijasuJJ55YPvvss3LkkUeW2WeffbRnvP322+Wkk04qCyywQHVG\/rHHHqtqAvT0mflffvml3HzzzdVvaNtXO+ywQ+nXr1+rzV9++WW5\/PLLW87pozhvuOGGlXPGQvo7tRjym1OHYcEFFyzbbLNNmW+++brk68MECBAgQIAAAQIECBDoqwJ9MszfeuutVYCbcsopy4orrlh+++23ct9995UPP\/ywbLLJJlVQ\/emnn8pzzz1XBcAPPvigbLDBBtV3EuiWWmqpavv+CSecUH744Yey6qqrljnmmKP63D333FMF6BS7m2qqqap+SZjPvRLwMxmwwgorlB9\/\/LHccccdJeFx6623LhtvvHH12TGF+ZzbP+2008off\/xRBeg865133qnavNBCC5UDDzywaleeceaZZ1bPWGuttarJhYTnb775phx22GFllllm6dI4SZjPZEUCbe6ZQoKxSh2CTHLsuuuuZfXVVy933XVXdRQhkwabbbbZaM+o77H33nuX5ZdfvldW5tNHp59+ennttdfK0ksvXRZffPGWf37PoYceWuadd97KKX2a35YJljnnnLOafHnmmWfKjjvuWP3+9NnFF19cTU6sssoqlccDDzxQTa4cfPDBZYoppuiSsQ8TIECAAAECBAgQIECgLwr0yTB\/4403lvXXX78K0Qm8ub766qty3HHHlazgHnPMMWXWWWdtBfGOKtF\/\/\/33ZfLJJ2\/dI1+4\/vrrq9X+FNxbdtllW\/d48sknWxMF9Qr5+++\/X44\/\/vgqAOaZCc3tw3zac8opp1QTDUcccUSZa665Wv38+OOPl\/POO6\/sueeeVVA+\/\/zzy1NPPVWF06wWj+uVIB6rTDRkgqOuO5BdC1mNn3vuuatnxeHYY4+tLLI6nxoFufLnMc1V\/3lvbLO\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gQIECBAgAABAgQIjLuAMD\/uhu7wLwFh3lAgQIAAAQIECBAgQIBAzwgI8z3j\/D\/xFGH+f6Kb\/UgCBAgQIECAAAECBPqAQJ8L833ARBMIECBAgAABAgQIECBAgECfFhDm+3T3aBwBAgQIECBAgAABAgQIEPi7gDBvVBAgQIAAAQIECBAgQIAAgYYJCPMN6zDNJUCAAAECBAgQIECAAAECwrwxQIAAAQIECBAgQIAAAQIEGiYgzDeswzSXAAECBAgQIECAAAECBAgI88YAAQIECBAgQIAAAQIECBBomIAw37AO01wCBAgQIECAAAECBAgQICDMGwMECBAgQIAAAQIECBAgQKBhAsJ8wzpMcwkQIECAAAECBAgQIECAgDBvDBAgQIAAAQIECBAgQIAAgYYJCPMN6zDNJUCAAAECBAgQIECAAAECwrwxQIAAAQIECBAgQIAAAQIEGiYgzDeswzSXAAECBAgQIECAAAECBAgI88YAAQIECBAgQIAAAQIECBBomIAw37AO01wCBAgQIECAAAECBAgQICDMGwMECBAgQIAAAQIECBAgQKBhAsJ8wzpMcwkQIECAAAECBAgQIECAgDBvDBAgQIAAAQIECBAgQIAAgYYJCPMN6zDNJUCAAAECBAgQIECAAAECwrwxQIAAAQIECBAgQIAAAQIEGiYgzDeswzSXAAECBAgQIECAAAECBAgI88YAAQIECBAgQIAAAQIECBBomIAw37AO01wCBAgQIECAAAECBAgQICDMGwMECBAgQIAAAQIECBAgQKBhAsJ8wzpMcwkQIECAAAECBAgQIECAgDBvDBAgQIAAAQIECBAgQIAAgYYJCPMN6zDNJUCAAAECBAgQIECAAAECwrwxQIAAAQIECBAgQIAAAQIEGiYgzDeswzSXAAECBAgQIECAAAECBAgI88YAAQIECBAgQIAAAQIECBBomIAw37AO01wCBAgQIECAAAECBAgQIPB\/VzVFfdqZOn8AAAAASUVORK5CYII=\" alt=\"\"><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"817\" height=\"846\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-10.png\" alt=\"\" class=\"wp-image-340\" style=\"width:831px;height:auto\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-10.png 817w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-10-290x300.png 290w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-10-768x795.png 768w\" sizes=\"auto, (max-width: 817px) 100vw, 817px\" \/><\/figure>\n\n\n\n<p>To display rules in chains with rule numbers, use:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"90\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-11.png\" alt=\"\" class=\"wp-image-341\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-11.png 1020w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-11-300x26.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-11-768x68.png 768w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/figure>\n\n\n\n<p>This is useful if you want to delete a rule (e.g. delete rule number 9 from the INPUT chain):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1025\" height=\"91\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-12.png\" alt=\"\" class=\"wp-image-342\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-12.png 1025w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-12-300x27.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-12-768x68.png 768w\" sizes=\"auto, (max-width: 1025px) 100vw, 1025px\" \/><\/figure>\n\n\n\n<p>Or, add a rule between two existing rules (e.g. add a firewall rule between rules number 2 and 3):<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1022\" height=\"121\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-13.png\" alt=\"\" class=\"wp-image-343\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-13.png 1022w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-13-300x36.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-13-768x91.png 768w\" sizes=\"auto, (max-width: 1022px) 100vw, 1022px\" \/><\/figure>\n\n\n\n<p>In order to list all commands that were used to create the currently used iptables rules, use the following command:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1022\" height=\"118\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-14.png\" alt=\"\" class=\"wp-image-344\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-14.png 1022w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-14-300x35.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-14-768x89.png 768w\" sizes=\"auto, (max-width: 1022px) 100vw, 1022px\" \/><\/figure>\n\n\n\n<p>This command is useful if you need to edit or delete some firewall rules.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1025\" height=\"807\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-15.png\" alt=\"\" class=\"wp-image-345\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-15.png 1025w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-15-300x236.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-15-768x605.png 768w\" sizes=\"auto, (max-width: 1025px) 100vw, 1025px\" \/><\/figure>\n\n\n\n<p><strong>Clear all firewall rules:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"92\" src=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-16-1024x92.png\" alt=\"\" class=\"wp-image-346\" srcset=\"https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-16-1024x92.png 1024w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-16-300x27.png 300w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-16-768x69.png 768w, https:\/\/www.vpsjungle.in\/tutorials\/wp-content\/uploads\/2024\/03\/image-16.png 1027w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Use \u2018iptables -h | less\u2019 for more information on all iptables command options.<\/p>\n\n\n\n<p>Hope this article helps you, please share your valuable comments to improve us.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are using Computers for while, you must be familiar with the word \u201cFirewall\u201d. We know that things do seem complex from the surface but through this tutorial, we are going to explain the basis of IPTable and the use of basic commands so that even if you are a networking student or want [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":353,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-324","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-firewall"],"_links":{"self":[{"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/posts\/324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/comments?post=324"}],"version-history":[{"count":6,"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/posts\/324\/revisions"}],"predecessor-version":[{"id":352,"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/posts\/324\/revisions\/352"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/media\/353"}],"wp:attachment":[{"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/media?parent=324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/categories?post=324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vpsjungle.in\/tutorials\/wp-json\/wp\/v2\/tags?post=324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}