CentOS Firewall

1. Basic operation

Check firewall status: service iptables status

Stop the firewall: service iptables stop

Start the firewall: service iptables start

Restart the firewall: service iptables restart

Permanently turn off the firewall: chkconfig iptables off

 

2. Check the firewall status, the firewall is on and only 22 ports are open


 

 

3. Open port 80

 vim /etc/sysconfig/iptables
# Add the following code to compare two gourds:)
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT


 

4. Restart the firewall after saving and exiting

service iptables restart

 

The same goes for opening other ports.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326002201&siteId=291194637