防火墙关闭:

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. leetcode解题报告(20):Rotate Array

    描述 Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the arr ...

  2. python3 数据类型测试

    type(要测试的数据):

  3. JDK8中好用的日期处理-LocalDate类-LocalTime-LocalDateTIme,mysql解决时区相差13小时的问题,日期格式器DateTimeFormatter

    set global time_zone='+08:00'; set time_zone = '+08:00'; show variables like '%time_zone:'

  4. PHP 多维数组 根据字段排序

    这个太常用了,记录下.方便后面用 /** * @param $arr [要排序的数组] * @param $condition [要排序的条件, for array('id'=>SORT_DES ...

  5. (转)代码审计利器-RIPS实践

    一.代码审计工具介绍 代码审计工具可以辅助我们进行白盒测试,大大提高漏洞分析和代码挖掘的效率. 在源代码的静态安全审计中,使用自动化工具辅助人工漏洞挖掘,一款好的代码审计软件,可以显著提高审计工作的效 ...

  6. Visual Studio2019安装步骤

    学校使用的版本是2012版本,而现在讲的版本是2019版本,差别不大,个人认为2019更能胜任学习任务. 另外VS2019是完全免费的,版本越高越好了!毕竟C++都出了C++20对吧. Step 1: ...

  7. python 3 安装

    如果本机安装了python2,尽量不要管他,使用python3运行python脚本就好,因为可能有程序依赖目前的python2环境, 比如yum!!!!! 不要动现有的python2环境! 一.安装p ...

  8. C++删除字符串的前后空格

    函数: string trim(string& str) { str.erase(0, str.find_first_not_of(" \t")); // 去掉头部空格 s ...

  9. RK3288 添加普通串口uart1和uart3

    CPU:RK3288 系统:Android 5.1 diff --git a/device/rockchip/common/init.connectivity.rc b/device/rockchip ...

  10. angular 中*ngIf 和*ngSwitch判断语句

    <div style="text-align:center"> <h1> Welcome to {{ title }}! </h1> <p ...