#/Sbin/iptables-IINPUT-ptcp -- dport80-jACCEPT #/sbin/iptables-IINPUT-ptcp -- dport22-jACCEPT #/sbin/iptables-IINPUT-ptcp -- dport3306-jACCEPT and then save: #/etc/rc. d/init. d/ipt
#/Sbin/
Iptables-I INPUT-p tcp -- dport 80-j ACCEPT
#/Sbin/iptables-I INPUT-p tcp -- dport 22-j ACCEPT
#/Sbin/iptables-I INPUT-p tcp -- dport 3306-j ACCEPT
Then save:
#/Etc/rc. d/init. d/iptables save
View opened ports:
#/Etc/init. d/iptables status
-------------------
Note:
# Disable the firewall
/Etc/init. d/iptables stop
Service iptables stop # stop the service
# View firewall information
/Etc/init. d/iptables status
# Port: 8080
/Sbin/iptables-I INPUT-p tcp? Dport 8080-j ACCEPT
# Restart the firewall to make the changes take effect: (or directly restart the system)
/Etc/init. d/iptables restart
# Save the changes
/Etc/rc. d/init. d/iptables save
In addition, add a line directly in/etc/sysconfig/iptables:
-A RH-Firewall-1-INPUT-m state? State NEW-m tcp-p tcp? Dport8080-j ACCEPT # permanently disable the firewall
Chkconfig? Level 35 iptables off # this method is derived from the network and has not been tested. Therefore, you are not allowed to use this method for security reasons.