防火墙关闭:

systemctl stop firewalld

systemctl disable firewalld

重启防火墙:

systemctl enable firewalld

systemctl start firewalld

systemctl restart firewalld

查看状态:

systemctl status firewalld

查看已经开放的端口

firewall-cmd --list-ports

开启端口

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

#开启多个端口:

firewall-cmd --zone=public --add-port=80-90/tcp --permanent

#删除端口

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

命令含义:

–zone #作用域

–add-port=80/tcp #添加端口,格式为:端口/通讯协议

–permanent #永久生效,没有此参数重启后失效

开启端口后记得重启

firewall -cmd --reload

防火墙其他命令

#停止firewall

systemctl stop firewalld.service

#禁止firewall开机启动

systemctl disable firewalld.service

四、基本操作

1、启动服务:systemctl start firewalld.service

2、关闭服务:systemctl stop firewalld.service

3、重启服务:systemctl restart firewalld.service

4、显示服务的状态:systemctl status firewalld.service

5、开机自动启动:systemctl enable firewalld.service

6、禁用开机自动启动:systemctl disable firewalld.service

7、查看版本: firewall-cmd --version

8、查看帮助: firewall-cmd --help

9、显示状态: firewall-cmd --state

10、查看所有打开的端口: firewall-cmd --zone=public --list-ports

11、更新防火墙规则: firewall-cmd --reload

12、查看区域信息:  firewall-cmd --get-active-zones

13、查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0

14、拒绝所有包:firewall-cmd --panic-on

15、取消拒绝状态: firewall-cmd --panic-off

16、查看是否拒绝: firewall-cmd --query-panic

centos 防火墙相关命令的更多相关文章

  1. CentOS防火墙相关命令

    针对于CentOS-6(CentOS-7命令不同,CentOS-8输入以下指令会自动定向,可以通用) 查看防火墙状态 # service iptables status 关闭防火墙 # service ...

  2. iptables防火墙相关命令详解

    前提基础: 当主机收到一个数据包后,数据包先在内核空间中处理,若发现目的地址是自身,则传到用户空间中交给对应的应用程序处理,若发现目的不是自身,则会将包丢弃或进行转发. iptables实现防火墙功能 ...

  3. linux 防火墙相关命令

    1.系统命令systemctl start firewalld #启动 systemctl status firewalld #查看运行状态 systemctl stop firewalld #关闭 ...

  4. Ali_Cloud++:阿里云服务器防火墙相关命令

    systemctl start firewalld ##启动Firewall systemctl stop firewalld ##关闭Firewall systemctl restart firew ...

  5. linux和ubuntu防火墙相关命令

    1.永久有效 开启: chkconfig iptables on 关闭: chkconfig iptables off 2.即刻生效 开启: service iptables start 关闭: se ...

  6. CentOS 防火墙常用命令

    1.查看防火墙状态: firewall-cmd --state 2.启动防火墙 systemctl start firewalld 3.关闭防火墙 systemctl stop firewalld 4 ...

  7. Linux系列(42) - 防火墙相关命令

    # 开启 service firewalld start # 重启 service firewalld restart # 关闭 service firewalld stop # 查看防火墙规则 fi ...

  8. 偷师--先留着。。ssh,nginx,防火墙相关命令

  9. centos7 防火墙相关命令

    启动:systemctl start firewalld禁用:systemctl stop firewalld重新载入规则:firewall-cmd --reload查看所有打开的端口:firewal ...

随机推荐

  1. Ubuntu18.04开机动画(bootsplash)安装

    一.搜索喜欢的主题 1.通过软件源搜索,这个比较简单但是没有太喜欢的.-----------------------------------------------------------pipci@ ...

  2. package.json文件说明解释

    1.package.json是什么? 什么是Node.js的模块(Module)?在Node.js中,模块是一个库或框架,也是一个Node.js项目.Node.js项目遵循模块化的架构,当我们创建了一 ...

  3. 《Microsoft Visio 2013 Step by Step.pdf》

  4. 通过时间戳批量删除hbase的数据

    如何通过时间戳批量删除hbase的数据 我们使用hive关联hbase插入数据时,有时会写错数据,此时hbase中的数据量已经很大很大了(上亿).此时,我们要修改错误的数据,只需要删除写错的那部分数据 ...

  5. Go开发环境安装与环境变量配置

    1.Go安装包下载 https://studygolang.com/dl 2.安装 Windows平台下,直接下一步即可完成安装. 3.配置环境变量 系统变量 安装完成后,在系统变量的Path一栏,会 ...

  6. Android Studio如何删除一个Module

    当你想在Android Studio中删除某个module时,大家习惯性的做法都是选中要删除的module,右键去找delete.但是在Android  Studio中你选中module,右键会发现没 ...

  7. elasticsearch bootstrap.memory_lock

    检查bootstrap.memory_lock设置是否生效 get http://10.127.0.1:9200/_nodes?filter_path=**.mlockall 响应: { " ...

  8. spring boot 集成RabbitMQ的异常

    com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.clos ...

  9. MySQL 中视图和表的区别以及联系是什么?

    两者的区别: (1)视图是已经编译好的 SQL 语句,是基于 SQL 语句的结果集的可视化的表,而表不是. (2)视图没有实际的物理记录,而基本表有. (3)表是内容,视图是窗口. (4)表占用物理空 ...

  10. java.lang.ClassNotFoundException:org.apache.struts2.dispatcher.FilterDispatcher

    老版本的Struts2升级,启动报的错. org.apache.struts2.dispatcher.FilterDispatcher 是web.xml中对struts2  2.2版本的接入点的类. ...