1. Use the command to view port opening (no firewall is selected for installation)
[Email protected] ~]# iptables-l-nchain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy accept) target prot opt source destination Chain OUTPUT (policy accept) target prot opt SOURCE
2. Clear firewall rules (existing rules may not be performed)
[Email protected] ~]# iptables-F ~]# iptables-X #清除预设表filter中使用者自定链中的规则 [[Email protected]< /c11>~]#/etc/rc.d/init.d/iptables Save #保存以后下次重启才会开启
[Email protected] ~]# service iptables restart
3. Setting up firewall rules
[Email protected] ~]# iptables-~]# iptables-~]# iptables-p FORWARD DROP
This definition is to indicate that all requests that exceed the iptables two chain rule (input and forward) rules are discarded, and requests that exceed the output rules are acceptable, that is, control input, arbitrary output.
4. Add a rule
- -j ACCEPT
[email protected]~]# /etc/rc.d/init.d/iptables Save
This adds a 80 port TCP connection to input and output, and finally does not forget to save
Linux Firewall Open port