ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux CentOS7 防火墙操作

2020-07-07 13:03:24  阅读:55  来源: 互联网

标签:service firewall cmd 防火墙 firewalld CentOS7 systemctl linux


1, 查看防火墙状态:

firewall-cmd --state

systemctl status firewalld.service

2, 开启防火墙:

systemctl start firewalld.service

3,设置开机自启:

systemctl enable firewalld.service

4, 重启防火墙:

systemctl restart firewalld.service

5, 查看防火墙设置开机自启是否成功:

systemctl is-enabled firewalld.service;echo $?

6,关闭防火墙:

systemctl stop firewalld.service

7,开端口命令:

打开单个端口:firewall-cmd --zone=public --add-port=80/tcp --permanent

打开多个端口:firewall-cmd --zone=public --add-port=20000-29999/tcp --permanent

--permanent  为永久生效,不加为单次有效(重启失效)

8,查看开启端口:

netstat -ntlp 或:firewall-cmd --list-ports

9,关闭端口命令:

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

10、查看端口是否打开

firewall-cmd --zone=public --query-port=80/tcp

标签:service,firewall,cmd,防火墙,firewalld,CentOS7,systemctl,linux
来源: https://www.cnblogs.com/yingudan/p/13260152.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有