Iptables is used to set up, maintain, and inspect the tables of IPv4 packet filter rules in the Linux kernel. Several different tables may be defined. Each table contains a number of built-in chains and may also contain user-defined chains.
Each chain is a list of rules which can match a set of packets. Each rule specifies what to do with a packet that matches. This is called a `target', which may be a jump to a user-defined chain in the same table.
How shall I understand the concept of a chain?
Is a chain a fixed list of rules?
How shall I define/specify and use a chain? For example,
-A, --append chain rule-specification
Append one or more rules to the end of the selected chain. When the source and/or destination names resolve to more than one address, a rule will be added for each possible address combination.
In the following command is
INPUT the name of a chain? Is it a name that I can give arbitrarily? Does this chain have exactly two rules? Thanks.
iptables -A INPUT -p tcp -s localhost --dport 25 -j ACCEPT iptables -A INPUT -p tcp --dport 25 -j DROP