Common firewall commands under Linux

The firewall configuration of CentOS7 is very different from the previous version. The firewall of this version of CentOS7 uses firewall by default.

Here is a reference address: https://www.cnblogs.com/sucretan2010/p/10835175.html

1. Turn off the firewall:

1

systemctl stop firewalld.service

2. Turn on the firewall:

1

systemctl start firewalld.service

3. Turn off and start up:

1

systemctl disable firewalld.service

4. Turn on startup:

1

2

3

4

5

6

7

8

9

10

systemctl enable firewalld.service

List 

1 firewall-cmd --list-all  或者 firewall-cmd --zone=public --list-ports

 

5、防火墙添加端口

firewall-cmd --zone=public --add-port=8080/tcp --permanent

6 移除端口

firewall-cmd --zone=public --remove-port=80/tcp --permanent

7查看防火墙状态,是否是running

firewall-cmd --state                

8重新载入配置,比如添加规则之后,需要执行此命令 

firewall-cmd --reload

Guess you like

Origin blog.csdn.net/qq_38058456/article/details/109588366
Recommended