Firewall is a mechanism for managing packets flowing through the network. it mainly analyzes the packet header to determine whether packets can flow through the local machine. generally, firewall has two implementation methods: 1 software implementation, for example, 360 has a firewall function. 2 is implemented through hardware, and it also has its own hyping system, which is used to analyze and filter packets, providing better performance. Firewalls are mainly composed of tables.
Firewall is a mechanism for managing packets flowing through the network. it mainly analyzes the packet header to determine whether packets can flow through the local machine. generally, firewall has two implementation methods: 1 software implementation, for example, 360 has a firewall function. 2 is implemented through hardware, and it also has its own hyping system, which is used to analyze and filter packets, providing better performance.
A firewall consists of table structures and links.
IptablesStructure
Table
Iptables is composed of several tables, each of which is composed of several chains. Each table is responsible for different packet processing mechanisms, and each chain is responsible for different packet directions, the specific policies are set by the rules in the chain.
Filter table: used to filter packets
Nat table: used for address translation
Chain
INPUT chain: exists in the filter table and is mainly used to process packets entering the local machine.
OUTPUT chain: exists in the filter table and is mainly used to process packets that exit the local machine.
FORWARD chain: exists in the fileter table and is mainly used to process packets passing through the local machine.
PREROUTING: exists in the nat table and is mainly used to modify the destination address (DNAT)
POSTROUTING: exists in the nat table and is mainly used to modify the source address (SNAT)
Firewall configuration save file/etc/sysconfig/iptables
Firewall configuration save command service iptables save
Firewall start/stop/restart
Service iptables start
Service iptables stop
Service iptables restart
/Etc/init. d/iptables restart
/Etc/init. d/iptables stop
/Etc/init. d/iptables start
Chkconfig? Level 35 iptables off (Firewall permanently disabled)
Specified remote host access
Iptables A input-s ip-j accept
Change the default firewall chain policy and view
Iptables-P INPUT DROP
View table chain policies
Iptables-L
Enable related ports
Iptables-I INPUT-p tcp? Dport 80-j ACCEPT
-I-link name [rule number] insert a rule
-- Dport destination port
-P protocol
-J ACCEPT: allow packets to pass without blocking
-J DROP does not allow packet passing
View port enabling status
/Etc/init. d/iptables status