CENTOS6.8 firewall settings

1, the basic operation

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

# 查看防火墙状态

service iptables status

 

# 停止防火墙

service iptables stop

 

# 启动防火墙

service iptables start

 

# 重启防火墙

service iptables restart

 

# 永久关闭防火墙

chkconfig iptables off

 

# 永久关闭后重启

chkconfig iptables on

  

2, view the status of the firewall, the firewall is turned on and the only open port 22

3, open port 80

Vim / etc / sysconfig / iptables 
# adding the following code, than the two painted gourd dipper :) 
-A State --state the INPUT NEW -m -m -p TCP TCP 80 --dport -j ACCEPT

Save and exit reboot the firewall

service iptables restart

=================== dividing line ===================

Other open other ports is also true.

Guess you like

Origin blog.csdn.net/oZuoLuo123/article/details/88785822