#/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
Check to see if it already has:
[Email protected] ~]#/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
Two. Restart your computer.
1.CentOS operating system firewall is already open 80 and 22 ports by default
2. You should also not restart your computer here:
#/etc/init.d/iptables restart
Shut down the firewall and shut down its services:
3. View firewall information:
#/etc/init.d/iptables status
4. Turn off the Firewall service:
#/etc/init.d/iptables stop
Three. Permanently shut down the firewall
We can also permanently shut down the firewall, but I don't recommend it. Permanently shutting down the firewall can do this:
#chkconfig –level iptables off
You can also directly modify
/etc/sysconfig/iptables
Add a
-A rh-firewall-1-input-m state--state new-m tcp-p TCP--dport 80-j ACCEPT
Source: http://www.cnblogs.com/cnjava/p/3311950.html
Centos Open 80 Port