#/sbin/iptables-i input-p TCP--dport 80-j ACCEPT
#/sbin/iptables-i input-p TCP--dport 22-j ACCEPT #/etc/rc.d/init.d/iptables save After restarting the computer, The firewall has already opened 80 and 222 ports by default. Temporarily shut down the firewall completely, can not restart the machine: #/etc/init.d/iptables status # #查看防火墙状态 #/etc/init.d/iptable stop # #本次关闭防火墙 #/etc/init.d/iptable Res Tart # #重启防火墙永久性关闭防火墙: #chkconfig--level iptables off (note Two English small short-term; restart) : Set the firewall open port method as follows: Vi/etc/sysconfig/iptables when modifying a firewall, it is best to leave VNC and SSH management ports. Below is an example of a iptables: # Firewall configuration written by system-config-securitylevel# Manual Customization of this file was not recommended.*filter:input accept [0:0]:forward Accept [0:0]:output Accept [0:0]:rh-firew All-1-input-[0:0]-a input-j rh-firewall-1-input-a forward-j rh-firewall-1-input-a rh-firewall-1-input-i lo-j ACCEPT- A rh-firewall-1-input-p icmp–icmp-type any-j accept-a RH-FIREWALL-1-INPUt-p 50-j accept-a rh-firewall-1-input-p 51-j accept-a rh-firewall-1-input-m state–state established,related-j ACCE Pt-a rh-firewall-1-input-m state–state new-m tcp-p tcp–dport 53-j accept-a rh-firewall-1-input-m state–state NEW- M udp-p udp–dport 53-j accept-a rh-firewall-1-input-m state–state new-m tcp-p tcp–dport 22-j ACCEPT-A RH-Firewall -1-input-m state–state new-m tcp-p tcp–dport 25-j accept-a rh-firewall-1-input-m state–state new-m tcp-p TCP–DP ORT 80-j accept-a rh-firewall-1-input-m state–state new-m tcp-p tcp–dport 443-j accept-a rh-firewall-1-input-j REJ Ect–reject-with Icmp-host-prohibitedcommit To modify this file according to their own needs, for example, if you do not want to open the 80 port to provide Web services, then you should delete this line:-A Rh-firewall-1-input-m state–state new-m tcp-p tcp–dport 80-j Accept all modifications after you restart Iptables:service iptables restart you can verify Whether the rules are in effect: iptables-l So, we have completed the setup modification of the CentOS firewall.
Turn off the Linux firewall using the command line