sudo systemctl start firewalld
,关闭防火墙:sudo systemctl stop firewalld
,重启防火墙:sudo systemctl restart firewalld
,查看防火墙状态:sudo systemctl status firewalld
Vultr CentOS 7 firewalld防火墙打开、关闭等常用设置命令
1、打开firewalld防火墙:
```
sudo systemctl start firewalld
```
```
sudo systemctl stop firewalld
```
```
sudo systemctl status firewalld
```
```
sudo systemctl enable firewalld
```
```
sudo systemctl disable firewalld
```
```
sudo firewallcmd reload
```
```
sudo firewallcmd listall
```
```
sudo firewallcmd permanent addforwardport=port=80:proto=tcp:toport=8080
```
```
sudo firewallcmd permanent removeforwardport=port=80:proto=tcp:toport=8080
```
```
sudo firewallcmd permanent addrichrule='rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="80" accept'
```
```
sudo firewallcmd permanent addrichrule='rule family="ipv4" source address="192.168.1.100" reject'
```
相关问题与解答:
问题1:如何查看firewalld防火墙是否已经安装?
解答:可以使用以下命令查看firewalld防火墙是否已经安装:rpm qa | grep firewalld
,如果已经安装,会显示类似于firewalld0.7.45.el7.x86_64
的结果,如果没有安装,则不会显示任何结果。
问题2:如何在firewalld防火墙中开放某个端口?
解答:可以使用以下命令在firewalld防火墙中开放某个端口(以开放TCP协议的80端口为例):sudo firewallcmd zone=public addport=80/tcp permanent
,这将永久开放TCP协议的80端口,如果要开放UDP协议的端口,可以将addport=80/tcp
替换为addport=80/udp
。
感谢观看,欢迎留言评论,关注点赞!