Rules of IPTables Firewall

Rule 1: Since portable rules are ephemeral, they must be explicitly stored in order for them to remain in effect after a reboot. The iptables-persistent package is one approach to storing iptables rules on Ubuntu. Install it using apt as follows:

sudo apt install iptables-persistent

 

It will give the target Port Source.

 Output:

 

Rule 2: You will be prompted to decide whether to save your current firewall rules before beginning the installation. Run the following command after updating your firewall rules if you wish to preserve the changes:

sudo netfilter-persistent save

 

The netstat utility may be used to determine this. We will add the -4 argument because our application can only communicate over IPv4, but if you are also using IPv6, you can remove it. The additional arguments required to locate our running services are  -plunt.

Output:

 

How To Setup an Iptables Firewall to Enable Remote Access to Services in Linux

A system administrator can modify the IP packet filter rules of the Linux kernel firewall, which are implemented as various Netfilter modules, using the user-space utility application iptables. The filters are arranged in several tables, each of which has a set of rules on how to handle packets of network data. Using a set of programmable table rules, the Linux command line firewall Iptables enables system administrators to control both incoming and outgoing traffic. Iptables employ a collection of tables with chains that each contain a set of pre-configured or user-defined rules. A command-line firewall tool called iptables uses policy chains to allow or deny traffic. Iptables searches through its list of rules to find one that matches a connection that tries to establish itself on your system. In the absence of one, it falls back on the default course of action.

Similar Reads

Rules of IPTables Firewall

Rule 1: Since portable rules are ephemeral, they must be explicitly stored in order for them to remain in effect after a reboot. The iptables-persistent package is one approach to storing iptables rules on Ubuntu. Install it using apt as follows:...

Setup an Iptables Firewall

Step 1: The iptables command to add a rule to the firewall as shown below:...

Examples of IPTables

Example 1: Disabling/re-enabling ssh logins from dev2 to dev1...

Inserting and Deleting Rules

1. Inserting rules:...