1. Open the configuration file
[Root@localhost ~]# vi/etc/sysconfig/iptables
2. The correct configuration file
# Firewall configuration written by System-config-firewall# Manual Customization of this file are not recommended.*filter:input accept [0:0]: FORWARD ACCEPT [0:0]: OUTPUT ACCEPT [0:0]-A INPUT-< span class= "keyword" >m state–state established,related-j accept-a INPUT -P icmp-j accept-a input-i lo-j accept-a INPUT-m state–state NEW-m tcp-p tcp–dport 22-j accept-a INPUT-m state–state NEW-m tcp-p tcp–dport 80-j accept-a input-j reject–reject-with icmp-host-prohibited-a forward-j reject–reject-with Icmp-host-pro hibited COMMIT
-A INPUT-state– StateNEW-m tcp-p tcp–dport *-j AC
3. The newly opened port must be written on the back of Port 22
Restart the firewall for configuration to take effect
[Root@localhost ~]#/etc/init.d/iptables Restart
To view open ports
[Root@localhost ~]#/etc/init.d/iptables status
Shutting down the firewall
[Root@localhost ~]#/etc/init.d/iptables Stop
Linux (CentOS6.5) Open ports, configuring firewalls