{"id":14107,"date":"2025-05-08T09:29:37","date_gmt":"2025-05-08T09:29:37","guid":{"rendered":"https:\/\/greenwebpage.com\/community\/?p=14107"},"modified":"2025-05-08T09:34:43","modified_gmt":"2025-05-08T09:34:43","slug":"how-to-install-and-configure-iptables-on-debian-12","status":"publish","type":"post","link":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/","title":{"rendered":"How to Install and Configure Iptables on Debian 12"},"content":{"rendered":"\n<p>Linux system iptables is an advanced utility firewall that helps a system admin to set up and control the rules of traffic over the network. Even though newer Linux distributions have replaced iptables with nftables, iptables are still popular because of their extensive documentation, administrator familiarity, and overall maturity.<\/p>\n\n\n\n<p>This tutorial aims to show the steps of installing and configuring iptables on Debian 12 (Bookworm), starting from the installation all the way to executing the first set of rules.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><a id=\"post-14107-_rqzqyeexzmyo\"><\/a>Understanding iptables vs. nftables<\/h2>\n\n\n\n<p>Debian 12 provides a default firewall, nftables, that has already been configured and started. But don&#8217;t worry; having iptables installed alongside or instead of nftables is totally good, so it remains an option.<\/p>\n\n\n\n<p>Key differences:<\/p>\n\n\n\n<p>&#8211; <strong>nftables<\/strong>: Newer, more efficient framework with unified syntax<\/p>\n\n\n\n<p>&#8211; <strong>iptables<\/strong>: A legacy framework with separate utilities for IPv4 (iptables), IPv6 (ip6tables), etc.<\/p>\n\n\n\n<p>The features below attract many users to prefer iptables:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Known as one of the most ancient forms of firewall management within Linux Kernel systems.<\/li>\n\n\n\n<li>Its very easy to find pre-written scripts that automate the processes done in iptables.<\/li>\n\n\n\n<li>It works with older firewall programs that do not support newer models.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><a id=\"post-14107-_rq3925rfv0op\"><\/a>How to Install iptable on Debian 12?<\/h2>\n\n\n\n<p>To get started, confirm the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You have a Debian 12 machine.<\/li>\n\n\n\n<li>Either Root access or Sudo userboth will be able to give you administrative access.<\/li>\n\n\n\n<li>Should have the fundamental knowledge of the commands within the Operating System interface.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_ijxj5xskwdm1\"><\/a>Step 1: Update Your System<\/h3>\n\n\n\n<p>Update of package sets and even upgrading some of the previously existing package components:<\/p>\n\n\n\n<pre>sudo apt update<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1142\" height=\"365\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-1.png\" alt=\"sudo apt update\" class=\"wp-image-14108\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-1.png 1142w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-1-300x96.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-1-1024x327.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-1-768x245.png 768w\" sizes=\"(max-width: 1142px) 100vw, 1142px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>This ensures you&#8217;re working with the latest versions of all software.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_njbtc02zh897\"><\/a>Step 2: Install iptables<\/h3>\n\n\n\n<p>While Debian 12 comes with nftables by default, iptables can be installed easily:<\/p>\n\n\n\n<pre>sudo apt install iptables -y<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1140\" height=\"517\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-2.png\" alt=\"sudo apt install iptables -y\" class=\"wp-image-14109\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-2.png 1140w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-2-300x136.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-2-1024x464.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-2-768x348.png 768w\" sizes=\"(max-width: 1140px) 100vw, 1140px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>These specific commands, among others, stated above, will integrate the core manipulations that can only deal with IPv4. For users that also require support for IPv6, the commands remain the same.<\/p>\n\n\n\n<pre>sudo apt install ip6tables -y<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_afsbeuagxa24\"><\/a>Step 3: Verify the Installation<\/h3>\n\n\n\n<p>After installation, confirm whether iptables is installed or not:<\/p>\n\n\n\n<pre>sudo iptables --version<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"1147\" height=\"144\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-3.png\" alt=\"sudo iptables --version\" class=\"wp-image-14110\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-3.png 1147w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-3-300x38.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-3-1024x129.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-3-768x96.png 768w\" sizes=\"(max-width: 1147px) 100vw, 1147px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_68v335xyysji\"><\/a>Step 4: Check Current Rules<\/h3>\n\n\n\n<p>Before making changes, it&#8217;s good practice to check your current firewall rules:<\/p>\n\n\n\n<pre>sudo iptables -L -v<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1150\" height=\"464\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-4.png\" alt=\"sudo iptables -L -v\" class=\"wp-image-14111\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-4.png 1150w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-4-300x121.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-4-1024x413.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-4-768x310.png 768w\" sizes=\"(max-width: 1150px) 100vw, 1150px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>The command provides an adding layer listing layer rule to check all existing manipulations associated chains set value ACCEPT overcharge entered without pre or specify.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_32kmzgo6624o\"><\/a>Step 5: Install Persistent iptables Rules Package<\/h3>\n\n\n\n<p>Automatically, stored iptables rules are lost when rebooting the system. In order to enable saving and restoring rules without manual effort:<\/p>\n\n\n\n<pre>sudo apt install iptables-persistent -y<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1154\" height=\"369\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-5.png\" alt=\"sudo apt install iptables-persistent -y\" class=\"wp-image-14112\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-5.png 1154w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-5-300x96.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-5-1024x327.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-5-768x246.png 768w\" sizes=\"(max-width: 1154px) 100vw, 1154px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Current rules in IPv4 and IPv6 will be asked for during saving on installation. You have the option of either saving them or skipping this step if rules are not configured yet:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1153\" height=\"714\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-6.png\" alt=\"Configuring iptables\" class=\"wp-image-14113\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-6.png 1153w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-6-300x186.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-6-1024x634.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-6-768x476.png 768w\" sizes=\"(max-width: 1153px) 100vw, 1153px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>You can choose to save them or skip this step if you haven&#8217;t configured any rules yet:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1146\" height=\"680\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-7.png\" alt=\"Configuring iptables\" class=\"wp-image-14114\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-7.png 1146w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-7-300x178.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-7-1024x608.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-7-768x456.png 768w\" sizes=\"(max-width: 1146px) 100vw, 1146px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_5hbpytidms6b\"><\/a>Step 6: Basic iptables Configuration<\/h3>\n\n\n\n<p>Set Basic Firewall Rules for iptables. Enable flushing all existing rules first:<\/p>\n\n\n\n<pre>sudo iptables -F<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1143\" height=\"185\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-8.png\" alt=\"sudo iptables -F\" class=\"wp-image-14115\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-8.png 1143w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-8-300x49.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-8-1024x166.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-8-768x124.png 768w\" sizes=\"(max-width: 1143px) 100vw, 1143px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Let&#8217;s create a basic set of rules that adds the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Adds allowance for established and preceded connections<\/li>\n\n\n\n<li>Adds permission for SSH, port 22<\/li>\n\n\n\n<li>Allows inter-communication on the Same System (loopback)<\/li>\n\n\n\n<li>Restricts all incoming connections and traffic.<\/li>\n<\/ul>\n\n\n\n<p>Set default policies<\/p>\n\n\n\n<pre>sudo iptables -P INPUT DROP<\/pre>\n<pre>sudo iptables -P FORWARD DROP<\/pre>\n<pre>sudo iptables -P OUTPUT ACCEPT<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1148\" height=\"210\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-9.png\" alt=\"sudo iptables -P INPUT DROP\nsudo iptables -P FORWARD DROP\nsudo iptables -P OUTPUT ACCEPT\" class=\"wp-image-14116\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-9.png 1148w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-9-300x55.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-9-1024x187.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-9-768x140.png 768w\" sizes=\"(max-width: 1148px) 100vw, 1148px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Policies on circumvented rules are permissive (associated and allowed).<\/p>\n\n\n\n<pre>sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1146\" height=\"167\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-10.png\" alt=\"sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT\" class=\"wp-image-14117\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-10.png 1146w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-10-300x44.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-10-1024x149.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-10-768x112.png 768w\" sizes=\"(max-width: 1146px) 100vw, 1146px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>The permissive state allows for Loopback:<\/p>\n\n\n\n<pre>sudo iptables -A INPUT -i lo -j ACCEPT<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1143\" height=\"145\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-11.png\" alt=\"sudo iptables -A INPUT -i lo -j ACCEPT\" class=\"wp-image-14118\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-11.png 1143w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-11-300x38.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-11-1024x130.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-11-768x97.png 768w\" sizes=\"(max-width: 1143px) 100vw, 1143px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Let\u2019s allow SSH:<\/p>\n\n\n\n<pre>sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1147\" height=\"122\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-12.png\" alt=\"sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT\" class=\"wp-image-14119\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-12.png 1147w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-12-300x32.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-12-1024x109.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-12-768x82.png 768w\" sizes=\"(max-width: 1147px) 100vw, 1147px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Let\u2019s allow HTTP and HTTPS:<\/p>\n\n\n\n<pre>sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT<\/pre>\n<pre>sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1145\" height=\"166\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-13.png\" alt=\"sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT\nsudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT\" class=\"wp-image-14120\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-13.png 1145w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-13-300x43.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-13-1024x148.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-13-768x111.png 768w\" sizes=\"(max-width: 1145px) 100vw, 1145px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>For ICMP (ping) Permitting:<\/p>\n\n\n\n<pre>sudo iptables -A INPUT -p icmp -j ACCEPT<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1143\" height=\"117\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-14.png\" alt=\"sudo iptables -A INPUT -p icmp -j ACCEPT\" class=\"wp-image-14121\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-14.png 1143w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-14-300x31.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-14-1024x105.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-14-768x79.png 768w\" sizes=\"(max-width: 1143px) 100vw, 1143px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>To view rules that have been edited:<\/p>\n\n\n\n<pre>sudo iptables -L -v --line-numbers<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1145\" height=\"752\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-15.png\" alt=\"sudo iptables -L -v --line-numbers\" class=\"wp-image-14122\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-15.png 1145w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-15-300x197.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-15-1024x673.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-15-768x504.png 768w\" sizes=\"(max-width: 1145px) 100vw, 1145px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_cxpim9xjlfqr\"><\/a>Step 7: Save Your Rules<\/h3>\n\n\n\n<p>In order to allow changes after every reboot:<\/p>\n\n\n\n<pre>sudo netfilter-persistent save<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1153\" height=\"196\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-16.png\" alt=\"sudo netfilter-persistent save\" class=\"wp-image-14123\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-16.png 1153w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-16-300x51.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-16-1024x174.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-16-768x131.png 768w\" sizes=\"(max-width: 1153px) 100vw, 1153px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Or alternatively:<\/p>\n\n\n\n<pre>sudo iptables-save &gt; \/etc\/iptables\/rules.v4<\/pre>\n<pre>sudo ip6tables-save &gt; \/etc\/iptables\/rules.v6<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_volzabainu61\"><\/a>Step 8: Enable and Start the iptables Service<\/h3>\n\n\n\n<p>The system guarantees that iptables are on during boot when activated:<\/p>\n\n\n\n<pre>sudo systemctl enable netfilter-persistent<\/pre>\n<pre>sudo systemctl start netfilter-persistent<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1153\" height=\"268\" src=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-17.png\" alt=\"sudo systemctl enable netfilter-persistent\nsudo systemctl start netfilter-persistent\" class=\"wp-image-14124\" srcset=\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-17.png 1153w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-17-300x70.png 300w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-17-1024x238.png 1024w, https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/word-image-14107-17-768x179.png 768w\" sizes=\"(max-width: 1153px) 100vw, 1153px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_y03jknsfu5yi\"><\/a>Step 9: Firewall Testing<\/h3>\n\n\n\n<p>After configuring, start testing the firewall:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Verify if SSH is operational (If pre-set for configuration)<\/li>\n\n\n\n<li>Attempt server ping<\/li>\n\n\n\n<li>Attempt any service that has been permitted.<\/li>\n\n\n\n<li>Make an attempt to connect to a blocked port to ensure that the firewall is configured.<\/li>\n<\/ul>\n\n\n\n<p><strong>Advanced iptables Configuration<\/strong><\/p>\n\n\n\n<p>Once you have the basics working, you might want to implement more advanced rules:<\/p>\n\n\n\n<p><strong>Rate Limiting SSH Connections<\/strong><\/p>\n\n\n\n<p>SSH connection attempts can be limited to one per five-second interval to block automated login attempts:<\/p>\n\n\n\n<pre>sudo iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -m recent --set<\/pre>\n<pre>sudo iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW -m recent --update --seconds 60 --hitcount 4 -j DROP<\/pre>\n\n\n\n<p><strong>Port Forwarding<\/strong><\/p>\n\n\n\n<p>Change external port 8080 to internal port 80:<\/p>\n\n\n\n<pre>sudo iptables -t nat -A PREROUTING -p tcp --dport 8080 -j REDIRECT --to-port 80<\/pre>\n\n\n\n<p><strong>Dropped Packet Logging<\/strong><\/p>\n\n\n\n<p>Enable logging for dropped packets:<\/p>\n\n\n\n<pre>sudo iptables -N LOGGING<\/pre>\n<pre>sudo iptables -A INPUT -j LOGGING<\/pre>\n<pre>sudo iptables -A LOGGING -m limit --limit 2\/min -j LOG --log-prefix \"IPTables-Dropped: \" --log-level 4<\/pre>\n<pre>sudo iptables -A LOGGING -j DROP<\/pre>\n\n\n\n<p><strong>Listing Rules<\/strong><\/p>\n\n\n\n<p>For viewing all rules along with line numbers (handy for deletion):<\/p>\n\n\n\n<pre>sudo iptables -L -v --line-numbers<\/pre>\n\n\n\n<p><strong>Deleting Rules<\/strong><\/p>\n\n\n\n<p>Delete a specific rule (replacing NUMBER with actual line number):<\/p>\n\n\n\n<pre>sudo iptables -D INPUT NUMBER<\/pre>\n\n\n\n<p><strong>Inserting Rules<\/strong><\/p>\n\n\n\n<p>Insert a rule at a specific position:<\/p>\n\n\n\n<pre>sudo iptables -I INPUT 3 -p tcp --dport 3306 -j ACCEPT<\/pre>\n\n\n\n<p><strong>Troubleshooting Common Issues<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you make the mistake of blocking SSH, you might need console access to the device to manage and is needed to fix the rules.<\/li>\n\n\n\n<li>Make sure you have iptables-persistent installed and you&#8217;re saving the rules to prevent loss on reboot or restriction not persisting.<\/li>\n\n\n\n<li>Remember that using both may interfere with one another if you&#8217;re using them: conflicts with nftables.<\/li>\n\n\n\n<li>Ensure the right ports and protocols have been permitted and check if working services are, in fact, not working.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><a id=\"post-14107-_xbm43bcttah8\"><\/a>Conclusion<\/h3>\n\n\n\n<p>In this guide, we have covered how to Install Iptables on Debian 12 and perform basic to advanced configurations alongside rule persistent setups. Although Debian 12 has transitioned to using <strong>nftables <\/strong>as the default access control system, it is still comforting to know that <strong>iptables <\/strong>is an option for many sysadmins out there.<\/p>\n\n\n\n<p>For environments where firewalls are crucial, documenting and enabling a controlled process to update such configurations. It may reduce the chances of unintended disruptions to other network services on the system.<\/p>\n\n\n\t\t\t\t\t\t\t<h3 style=\"margin-bottom:20px;display:block;width:100%;margin-top:10px\">Frequently Asked Questions <\/h3>\r\n\t\t\t\t\t\t<style>\r\n\t\t\t\t<style>\r\n#wpsm_accordion_14128 .wpsm_panel-heading{\r\n\tpadding:0px !important;\r\n}\r\n#wpsm_accordion_14128 .wpsm_panel-title {\r\n\tmargin:0px !important; \r\n\ttext-transform:none !important;\r\n\tline-height: 1 !important;\r\n}\r\n#wpsm_accordion_14128 .wpsm_panel-title a{\r\n\ttext-decoration:none;\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\tpadding:0px;\r\n\tfont-size: 18px !important;\r\n\tfont-family: Open Sans !important;\r\n\tcolor:#000000 !important;\r\n\tborder-bottom:0px !important;\r\n}\r\n\r\n#wpsm_accordion_14128 .wpsm_panel-title a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#wpsm_accordion_14128 .wpsm_panel-title a:hover, #wpsm_accordion_14128 .wpsm_panel-title a:focus {\r\n\tcolor:#000000 !important;\r\n}\r\n#wpsm_accordion_14128 .acc-a{\r\n\tcolor: #000000 !important;\r\n\tbackground-color:#e8e8e8 !important;\r\n\tborder-color: #ddd;\r\n}\r\n#wpsm_accordion_14128 .wpsm_panel-default > .wpsm_panel-heading{\r\n\tcolor: #000000 !important;\r\n\tbackground-color: #e8e8e8 !important;\r\n\tborder-color: #e8e8e8 !important;\r\n\tborder-top-left-radius: 0px;\r\n\tborder-top-right-radius: 0px;\r\n}\r\n#wpsm_accordion_14128 .wpsm_panel-default {\r\n\t\tborder:1px solid transparent !important;\r\n\t}\r\n#wpsm_accordion_14128 {\r\n\tmargin-bottom: 20px;\r\n\toverflow: hidden;\r\n\tfloat: none;\r\n\twidth: 100%;\r\n\tdisplay: block;\r\n}\r\n#wpsm_accordion_14128 .ac_title_class{\r\n\tdisplay: block;\r\n\tpadding-top: 12px;\r\n\tpadding-bottom: 12px;\r\n\tpadding-left: 15px;\r\n\tpadding-right: 15px;\r\n}\r\n#wpsm_accordion_14128  .wpsm_panel {\r\n\toverflow:hidden;\r\n\t-webkit-box-shadow: 0 0px 0px rgba(0, 0, 0, .05);\r\n\tbox-shadow: 0 0px 0px rgba(0, 0, 0, .05);\r\n\t\tborder-radius: 4px;\r\n\t}\r\n#wpsm_accordion_14128  .wpsm_panel + .wpsm_panel {\r\n\t\tmargin-top: 5px;\r\n\t}\r\n#wpsm_accordion_14128  .wpsm_panel-body{\r\n\tbackground-color:#ffffff !important;\r\n\tcolor:#000000 !important;\r\n\tborder-top-color: #e8e8e8 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\toverflow: hidden;\r\n\t\tborder: 2px solid #e8e8e8 !important;\r\n\t}\r\n\r\n#wpsm_accordion_14128 .ac_open_cl_icon{\r\n\tbackground-color:#e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tfloat:right !important;\r\n\tpadding-top: 12px !important;\r\n\tpadding-bottom: 12px !important;\r\n\tline-height: 1.0 !important;\r\n\tpadding-left: 15px !important;\r\n\tpadding-right: 15px !important;\r\n\tdisplay: inline-block !important;\r\n}\r\n\r\n\t\t\t\r\n\t\t\t<\/style>\t\r\n\t\t\t<\/style>\r\n\t\t\t<div class=\"wpsm_panel-group\" id=\"wpsm_accordion_14128\" >\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_14128 \" href=\"javascript:void(0)\" data-target=\"#ac_14128_collapse1\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tHow do I install iptables on Debian 12?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_14128_collapse1\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tRun <code>sudo apt update &amp;&amp; sudo apt install iptables<\/code> in the terminal. This installs the iptables package from the Debian repository.\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"collapsed\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_14128 \" href=\"javascript:void(0)\" data-target=\"#ac_14128_collapse2\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tIs iptables pre-installed on Debian 12?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_14128_collapse2\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tYes, iptables is usually pre-installed. You can verify by running <code>iptables --version<\/code>.\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"collapsed\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_14128 \" href=\"javascript:void(0)\" data-target=\"#ac_14128_collapse3\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tHow do I view current iptables rules?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_14128_collapse3\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tUse <code>sudo iptables -L -v -n<\/code> to list current rules with details and without resolving hostnames.\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"collapsed\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_14128 \" href=\"javascript:void(0)\" data-target=\"#ac_14128_collapse4\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tHow do I add a basic rule to allow SSH?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_14128_collapse4\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tRun <code>sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT<\/code> to allow incoming SSH connections.\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t<!-- Inner panel Start -->\r\n\t\t\t\t\t<div class=\"wpsm_panel wpsm_panel-default\">\r\n\t\t\t\t\t\t<div class=\"wpsm_panel-heading\" role=\"tab\" >\r\n\t\t\t\t\t\t  <h4 class=\"wpsm_panel-title\">\r\n\t\t\t\t\t\t\t<a  class=\"collapsed\"  data-toggle=\"collapse\" data-parent=\"#wpsm_accordion_14128 \" href=\"javascript:void(0)\" data-target=\"#ac_14128_collapse5\" onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"ac_open_cl_icon fa fa-plus\"><\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t\t<span class=\"ac_title_class\">\r\n\t\t\t\t\t\t\t\t\tHow do I save iptables rules on Debian 12?\t\t\t\t\t\t\t\t<\/span>\r\n\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t  <\/h4>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t<div id=\"ac_14128_collapse5\" class=\"wpsm_panel-collapse collapse \"  >\r\n\t\t\t\t\t\t  <div class=\"wpsm_panel-body\">\r\n\t\t\t\t\t\t\tUse <code>sudo iptables-save &gt; \/etc\/iptables\/rules.v4<\/code> after installing <code>iptables-persistent<\/code>.\t\t\t\t\t\t  <\/div>\r\n\t\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<\/div>\r\n\t\t\t\t\t<!-- Inner panel End -->\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\t<\/div>\r\n\t\t\t\r\n<script type=\"text\/javascript\">\r\n\t\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.wpsm_panel .wpsm_panel-body iframe' ).width();\r\n\t\t\tvar height=jQuery( '.wpsm_panel .wpsm_panel-body iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\t\t\r\n<\/script>\t\n\n\n\n<p><\/p>\n\n    <div class=\"xs_social_share_widget xs_share_url after_content \t\tmain_content  wslu-style-1 wslu-share-box-shaped wslu-fill-colored wslu-none wslu-share-horizontal wslu-theme-font-no wslu-main_content\">\n\n\t\t\n        <ul>\n\t\t\t        <\/ul>\n    <\/div> \n","protected":false},"excerpt":{"rendered":"<p>Linux system iptables is an advanced utility firewall that helps a system admin to set up and control the rules of traffic over the network. Even though newer Linux distributions have replaced iptables with nftables, iptables are still popular because of their extensive documentation, administrator familiarity, and overall maturity. This tutorial aims to show the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":14131,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[297,284,285],"class_list":["post-14107","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-debian-12","tag-firewall","tag-iptables"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Install and Configure Iptables on Debian 12<\/title>\n<meta name=\"description\" content=\"This tutorial aims to show the steps of installing and configuring iptables on Debian 12 (Bookworm). Learn more!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install and Configure Iptables on Debian 12\" \/>\n<meta property=\"og:description\" content=\"This tutorial aims to show the steps of installing and configuring iptables on Debian 12 (Bookworm). Learn more!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/\" \/>\n<meta property=\"og:site_name\" content=\"Greenwebpage Community\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-08T09:29:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-08T09:34:43+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Karim Buzdar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Karim Buzdar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/\"},\"author\":{\"name\":\"Karim Buzdar\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8\"},\"headline\":\"How to Install and Configure Iptables on Debian 12\",\"datePublished\":\"2025-05-08T09:29:37+00:00\",\"dateModified\":\"2025-05-08T09:34:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/\"},\"wordCount\":877,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg\",\"keywords\":[\"Debian 12\",\"Firewall\",\"IPtables\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/\",\"url\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/\",\"name\":\"How to Install and Configure Iptables on Debian 12\",\"isPartOf\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg\",\"datePublished\":\"2025-05-08T09:29:37+00:00\",\"dateModified\":\"2025-05-08T09:34:43+00:00\",\"description\":\"This tutorial aims to show the steps of installing and configuring iptables on Debian 12 (Bookworm). Learn more!\",\"breadcrumb\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#primaryimage\",\"url\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg\",\"contentUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg\",\"width\":1020,\"height\":600,\"caption\":\"Install and Configure lptables on Debian 12\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/greenwebpage.com\/community\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install and Configure Iptables on Debian 12\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#website\",\"url\":\"https:\/\/greenwebpage.com\/community\/\",\"name\":\"Greenwebpage Community\",\"description\":\"Get online in three steps with our wide range of web hosting solutions. Choose from professional business to enterprise options designed to meet your needs.\",\"publisher\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/greenwebpage.com\/community\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#organization\",\"name\":\"Greenwebpage Community\",\"url\":\"https:\/\/greenwebpage.com\/community\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png\",\"contentUrl\":\"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png\",\"width\":512,\"height\":512,\"caption\":\"Greenwebpage Community\"},\"image\":{\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8\",\"name\":\"Karim Buzdar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g\",\"caption\":\"Karim Buzdar\"},\"sameAs\":[\"https:\/\/greenwebpage.com\"],\"url\":\"https:\/\/greenwebpage.com\/community\/author\/karim\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install and Configure Iptables on Debian 12","description":"This tutorial aims to show the steps of installing and configuring iptables on Debian 12 (Bookworm). Learn more!","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:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/","og_locale":"en_US","og_type":"article","og_title":"How to Install and Configure Iptables on Debian 12","og_description":"This tutorial aims to show the steps of installing and configuring iptables on Debian 12 (Bookworm). Learn more!","og_url":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/","og_site_name":"Greenwebpage Community","article_published_time":"2025-05-08T09:29:37+00:00","article_modified_time":"2025-05-08T09:34:43+00:00","og_image":[{"width":1020,"height":600,"url":"http:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg","type":"image\/jpeg"}],"author":"Karim Buzdar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Karim Buzdar","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#article","isPartOf":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/"},"author":{"name":"Karim Buzdar","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8"},"headline":"How to Install and Configure Iptables on Debian 12","datePublished":"2025-05-08T09:29:37+00:00","dateModified":"2025-05-08T09:34:43+00:00","mainEntityOfPage":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/"},"wordCount":877,"commentCount":0,"publisher":{"@id":"https:\/\/greenwebpage.com\/community\/#organization"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#primaryimage"},"thumbnailUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg","keywords":["Debian 12","Firewall","IPtables"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/","url":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/","name":"How to Install and Configure Iptables on Debian 12","isPartOf":{"@id":"https:\/\/greenwebpage.com\/community\/#website"},"primaryImageOfPage":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#primaryimage"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#primaryimage"},"thumbnailUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg","datePublished":"2025-05-08T09:29:37+00:00","dateModified":"2025-05-08T09:34:43+00:00","description":"This tutorial aims to show the steps of installing and configuring iptables on Debian 12 (Bookworm). Learn more!","breadcrumb":{"@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#primaryimage","url":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg","contentUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2025\/05\/Install-and-Configure-lptables-on-Debian-12-1.jpg","width":1020,"height":600,"caption":"Install and Configure lptables on Debian 12"},{"@type":"BreadcrumbList","@id":"https:\/\/greenwebpage.com\/community\/how-to-install-and-configure-iptables-on-debian-12\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/greenwebpage.com\/community\/"},{"@type":"ListItem","position":2,"name":"How to Install and Configure Iptables on Debian 12"}]},{"@type":"WebSite","@id":"https:\/\/greenwebpage.com\/community\/#website","url":"https:\/\/greenwebpage.com\/community\/","name":"Greenwebpage Community","description":"Get online in three steps with our wide range of web hosting solutions. Choose from professional business to enterprise options designed to meet your needs.","publisher":{"@id":"https:\/\/greenwebpage.com\/community\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/greenwebpage.com\/community\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/greenwebpage.com\/community\/#organization","name":"Greenwebpage Community","url":"https:\/\/greenwebpage.com\/community\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/","url":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png","contentUrl":"https:\/\/greenwebpage.com\/community\/wp-content\/uploads\/2023\/10\/cropped-logomic.png","width":512,"height":512,"caption":"Greenwebpage Community"},"image":{"@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/467c100c1d017bc081473ee0440680c8","name":"Karim Buzdar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/greenwebpage.com\/community\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0628fcbcddd9bc5486245d2cf4a904dbcdeac9ad6c3098f49237094e9d513d0c?s=96&d=mm&r=g","caption":"Karim Buzdar"},"sameAs":["https:\/\/greenwebpage.com"],"url":"https:\/\/greenwebpage.com\/community\/author\/karim\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/14107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/comments?post=14107"}],"version-history":[{"count":4,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/14107\/revisions"}],"predecessor-version":[{"id":14129,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/posts\/14107\/revisions\/14129"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/media\/14131"}],"wp:attachment":[{"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/media?parent=14107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/categories?post=14107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greenwebpage.com\/community\/wp-json\/wp\/v2\/tags?post=14107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}