Common Linux Commands – Part 6

Common Linux Commands – Part 6

6. Application Commands:

-t filter: Indicates adding rules at the end of the chain (if no table name is specified, the default is the filter table)
-I INPUT: Indicates adding an inbound rule at the first line of the filter table (-I INPUT 2 indicates adding an inbound rule at the second line)
-A INPUT: Indicates appending a rule at the end of the filter table
-i: Indicates the inbound network card
-o: Indicates the outbound network card
-m multiport: Indicates multi-port matching (e.g., -m multiport --dport25,80,110,143)
-m mac: Indicates disabling host connections (e.g., -m mac --mac-source00:00:00:25:44:54)
-m state: Indicates state matching (e.g., -m state --state ESTABLISHED)
-p protocol e.g., iptables -A INPUT -p tcp
-s source address e.g., iptables -A INPUT -s 10.1.1.1
-d destination address e.g., iptables -A INPUT -d 10.1.1.1
--sport source port e.g., iptables -A INPUT -P tcp --sport 22
--dport destination port e.g., iptables -A INPUT -p tcp --dport 22
-j action handling
DROP: Discard (drop directly)
REJECT: Discard (send ICMP unreachable message)
.LOG: Log packet information to syslog
ACCEPT: Allow packets to pass
systemctl stop firewalld: Stop the firewall service
systemctl disable firewalld: Disable the firewall service
yum -y install iptables iptables-services: Install iptables firewall service
systemctl start iptables: Enable firewall service on boot
systemctl enable iptables: Enable firewall service
iptables -L: View all rule entries
iptables -D INPUT 4: Delete the fourth rule in INPUT
iptables -F INPUT: Clear all rules in INPUT

Leave a Comment