Linux iptables: Rule Composition
Linux iptables: Rule principles and basics describes the four-table and five-chain links of iptables, which are the mount points through which packets at different network layers will pass, which table can be used to define rules for each mount point.
This article describes the composition of an iptables rule.
Linux iptables: Rule Composition
--------------------------------------------------------------------------------
This is the basic composition of iptables rules and the command format for iptables to define rules:
The first column is the iptables command;
The second column specifies the table where the rule is located. nat and filter tables are commonly used;
The third column is the command. Common commands are as follows:
-A adds A new rule (append) to the end of the specified chain.
-D delete: Specifies a rule in the chain, which can be deleted according to the rule sequence number and content.
-I insert a new rule in the specified chain. By default
-R: modify or replace a rule in a specified chain, which can be replaced by the rule sequence number and content.
-L list all the rules in the specified chain for viewing
-F flush rule
-P: Set the Default policy for the specified chain)
-N displays the output in the numeric format (numeric)
The fourth column is the mount point to which the rule applies;
The Fifth Column is options. Common options are as follows:
-P indicates the protocol.
-S source address
-D Destination Address
-- Sport source port number
-- Dport destination port number
-- Dports destination port number list
-M supplement
The sixth column is rules. Common rules are as follows:
ACCEPT allows data packets to pass through
DROP directly discards data packets without any response information
The REJECT rejects data packets and sends a response to the data sender if necessary.
SNAT rewrite the data packet source address
DNAT rewrite the destination address of the Data Packet
LOG Record Data Packets
The commands and parameters used in iptables rule definition are described as follows.
-------------------------------------- Split line --------------------------------------
Disable the default firewall in CentOS 7.0 and enable the iptables firewall.
Iptables examples
Linux Firewall iptables
Basic use of iptables backup, recovery, and firewall scripts
Detailed description of firewall iptables usage rules in Linux
-------------------------------------- Split line --------------------------------------
This article permanently updates the link address: