Linux(一):Centos7自带的防火墙工具firewall一些常用命令

Centos7自带的防火墙工具firewall
firewall 能够允许哪些服务可用,哪些端口可用,属于更高一层的防火墙。

下面是centos7防火墙firewall的一些常用命令。
1.查看防火墙状态:
firewall-cmd --state

[root@linuxprobe sysconfig]$ firewall-cmd --state
running

2.启动防火墙
systemctl start firewalld

3.关闭防火墙
systemctl stop firewalld

4.检查防火墙开放的端口
firewall-cmd --permanent --zone=public --list-ports

[root@linuxprobe sysconfig]$ firewall-cmd --permanent --zone=public --list-ports
8080/tcp 3306/tcp 8088/tcp
 

5.开放一个新的端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent

6.重启防火墙
firewall-cmd --reload

7.验证新增加端口是否生效
firewall-cmd --zone=public --query-port=8080/tcp

[root@linuxprobe sysconfig]$ firewall-cmd --zone=public --query-port=8080/tcp
yes

8.防火墙取消某一开放端口
firewall-cmd --zone=public --remove-port=8200/tcp --permanent

9.#永久关闭防火墙
执行开机禁用防火墙自启命令
systemctl disable firewalld.service
systemctl disable firewalld

10.关于防火墙的其他命令:
启动防火墙:systemctl start firewalld.service

防火墙开机自启动
systemctl enable firewalld.service
防火墙随系统开启启动  : systemctl enable firewalld.service

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宁宁可可

您的鼓励是我创作的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值