防火墙关闭:

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. decodeURI 与 decodeURIComponent 区别

    1. 关于URL.encodeURI 及 encodeURIComponent: URI: Uniform Resource Identifiers,通用资源标识符 Global 对象的 encode ...

  2. 分治 FFT学习笔记

    先给一道luogu板子题:P4721 [模板]分治 FFT 今天模拟有道题的部分分做法是分治fft,于是就学了一下.感觉不是很难,国赛上如果推出式子的话应该能写出来. 分治fft用来解决这么一个式子\ ...

  3. 8、RDD持久化

    一.RDD持久化 1.不使用RDD持久化的问题 2.RDD持久化原理 Spark非常重要的一个功能特性就是可以将RDD持久化在内存中.当对RDD执行持久化操作时,每个节点都会将自己操作的RDD的par ...

  4. shiro 配置注解后无权访问不进行页面跳转异常:org.apache.shiro.authz.UnauthorizedException: Subject does not have permission

    该问题需要使用异常管理: <!-- 无权访问跳转的页面 --> <bean class="org.springframework.web.servlet.handler.S ...

  5. selenium鼠标操作

    #-*- coding:utf-8 -*- import time from selenium import webdriver from selenium.webdriver.common.acti ...

  6. Centos7 开启swap分区

    阿里云购买的机器,默认不会开启swap分区,如有需要,需自行开启. 阿里当前的做法是: 1.不创建swap分区,由镜像决定 2.将vm.swappiness设定为0,即永不使用swap分区 开启swa ...

  7. Linux fdisk命令创建扩展分区过程

    [root@localhost ~]# fdisk /dev/sdb …省略部分输出… Command (m for help): n #新建立分区 Command action e extended ...

  8. Random Projection

    Random Projection在k-means的应用   1. 随机投影 (Random Projection) 首先,这是一种降维方法.之前已经介绍过相对普遍的PCA的降维方法,这里介绍另一种降 ...

  9. yarn 单点故障 重启 ResourceManger Restart

    http://hadoop.apache.org/docs/stable/hadoop-yarn/hadoop-yarn-site/ResourceManagerRestart.html Featur ...

  10. PHP使用MongoDB存储经纬度,查询距离

    https://blog.csdn.net/qq_40012295/article/details/84861466 https://docs.mongodb.com/manual/reference ...