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:
Step 2: Execute the command to let install iptables on your Linux Mint system:
Step 3: Run the version command to ensure its latest update:
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:
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:
Apply iptables Rules
You can make use of these above-mentioned flags for different purposes, like:
1: To allow the traffic on localhost, type:
2: To enable HTTP port (80) service, type:
3: To enable HTTPS port (443) service, type the given command:
Check if all rules you have made are applied successfully by executing the given command:
You can also list down these rules with the numbers by typing:
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:
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:
Rule 3 has been removed.
Conclusion
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.