Linux Mint

How to Install iptables on Linux Mint 21

The iptables is a powerful and handy firewall application for Linux systems that lets you secure your system by implementing rules based on your preferences. It monitors and handles all the network traffic. The iptables firewall configuration includes incoming and outgoing connections using tables and each table contains several built-in chains. In each chain, you will find the list of rules, which you can manage on your system and set the rules according to your choice.

Install iptables on Linux Mint 21

To install iptables on Linux Min 21, follow the below-mentioned steps:

Step 1: Upgrade your Linux Mint system first to refresh all the packages and system repositories:

$ sudo apt update && sudo apt upgrade

Step 2: Execute the command to let install iptables on your Linux Mint system:

$ sudo apt install iptables

Step 3: Run the version command to ensure its latest update:

$ iptables --version

iptables Chain Rules

Let’s execute some commands to explain iptables firewall rules on Linux Mint 21 system.

Type the command to display the iptables current status:

$ sudo iptables -L -v

In the above-mentioned command, -L flag is used to list down all rules, and -v is used to show detailed format information.

iptables Help Command

Run the iptables help command to display flag uses with their symbols:

$ sudo iptables -h

Apply iptables Rules

You can make use of these above-mentioned flags for different purposes, like:

1: To allow the traffic on localhost, type:

$ sudo iptables -A INPUT -i lo -j ACCEPT

2: To enable HTTP port (80) service, type:

$ sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT

3: To enable HTTPS port (443) service, type the given command:

$ sudo iptables --A INPUT -p tcp --dport 443 -j ACCEPT

Check if all rules you have made are applied successfully by executing the given command:

$ sudo iptables -L -v

You can also list down these rules with the numbers by typing:

$ sudo iptables -L --line-numbers

Deleting iptables Rules

If you want to remove identified rules, the -F flag will be used. This would delete all the rules you have applied and start with a fresh state.

To remove all rules, run:

$ sudo iptables -F


However, if you want to delete a specific rule, the command would be like this:

You can change the input number according to your choice.

Now run the following command to display if the rule has been deleted:

$ sudo iptables -L --line-numbers

Rule 3 has been removed.


The iptables is a firewall application used by Linux administrators for managing incoming and outgoing server traffic. It handles all the connection rules. You can set or modify any rule that suits your server using this firewall program. This article has covered the iptables firewall installation process on Linux Mint with some examples including how you put-up rules and delete them.

About the author

Syeda Wardah Batool

I am a Software Engineer Graduate and Self Motivated Linux writer. I also love to read latest Linux books. Moreover, in my free time, i love to read books on Personal development.