There are a lot of questions about how to set the CentOS firewall. below is how to set the CentOS firewall. I saw several pages CentOS firewall content are wrong, the following is the correct method: # sbiniptables-IINPUT-ptcp -- dport80-jACCEPT # sbiniptable
There are a lot of questions about how to set the CentOS firewall. below is how to set the CentOS firewall.
After reading several pages, there are errors in CentOS firewall content. The following is the correct method:
-
#/Sbin/iptables-I INPUT-p tCp-- Dport 80-j ACCEPT
- #/Sbin/iptables-I INPUT-p tcp -- dport 22-j ACCEPT
|
Then save: #/etc/rc. d/init. d/iptables save and restart the computer. By default, ports 80 and 22 are enabled for the firewall.
The CentOS firewall settings have been completed.
In this case, you may not restart the computer: #/etc/init. d/iptables restart the firewall to close the firewall and view the firewall information: #/etc/init. d/iptablesStatUs disable the Firewall Service: #/etc/init. d/iptables stop permanently disabled?
I don't know how to use the permanent method :#Chkconfig-Level 35 iptables off and check whether there is already one:
-
[Root @ vcentos ~] #/Etc/init. d/iptables status
- Table: filter
- Chain INPUT (policy ACCEPT)
- Num target prot opt source destination
- 1 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt: 80
- 2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 80
- 3 RH-FireWall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
- Chain FORWARD (policy ACCEPT)
- Num target prot opt source destination
- 1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
|
You can set up the CentOS firewall in the future.