View firewall status
Service Iptables Status
View current firewall rules
Iptables-l-N
Clears the rules for all rule chains in the preset table filter
Iptables-f
Vi/etc/sysconfig/iptables
-A input-p tcp-m state--state new-m TCP--dport 80-j ACCEPT add allow port through firewall and save/etc/init.d/iptables Save Restart Iptable s effective
Iptables-a input-p TCP--dport 22-j ACCEPT External Add temporary firewall rule fails after reboot
iptables-d input-p TCP--dport 22-j ACCEPT Delete temporary firewall rule
Iptables-a input-s 192.168.0.3-p tcp--dport 22-j ACCEPT #只允许该IP连接该机器22端口
PS: If you want to allow or restrict a certain IP address to be available 192.168.0.0/24 represents all IPs on the 192.168.0.1-255 side.
24 indicates the number of subnet masks. But remember to delete the line in the/etc/sysconfig/iptables.
-A input-p tcp-m TCP--dport 22-j ACCEPT because it means all addresses can be logged in.
Iptables-a input-p tcp–dport 21-j ACCEPT
Iptables-a input-p tcp–dport 20-j ACCEPT
#允许FTP服务的21和20端口
Restrict access to an IP
Iptables-i input-s ***.***.***.***-j DROP
Disable IP
iptables-d input-s ***.***.***.***-j DROP
Linux firewall rules