CentOS 使用firewalld打开防火墙与端口

LinuxCentOS

基本使用

启动 : systemctl start firewalld

关闭 : systemctl stop firewalld

查看状态 : systemctl status firewalld

开机禁用 : systemctl disable firewalld

开机启用 : systemctl enable firewalld


systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体

启动一个服务:systemctl start firewalld.service

关闭一个服务:systemctl stop firewalld.service

重启一个服务:systemctl restart firewalld.service

显示一个服务的状态:systemctl status firewalld.service

在开机时启用一个服务:systemctl enable firewalld.service

在开机时禁用一个服务:systemctl disable firewalld.service

查看服务是否开机启动:systemctl is-enabled firewalld.service

查看已启动的服务列表:systemctl list-unit-files|grep enabled

查看启动失败的服务列表:systemctl --failed


配置firewalld-cmd

查看版本: firewall-cmd --version

查看帮助: firewall-cmd --help

显示状态: firewall-cmd --state

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

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

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

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

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

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

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


那怎么开启一个端口呢

添加 firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)

重新载入firewall-cmd --reload

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

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

CentOS 使用firewalld打开防火墙与端口的更多相关文章

  1. windows 使用命令打开防火墙的端口

    Open TCP Port 80 in Windows Firewall Using Netsh [McNeel Wiki]https://wiki.mcneel.com/zoo/zoo5netsh ...

  2. CentOS7使用firewalld管理防火墙与端口

    firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status fir ...

  3. Linux(例如CentOS 7)打开TCP 22端口,基于SSH协议

    SSH 为 Secure Shell 的缩写,由 IETF 的网络工作小组(Network Working Group)所制定:SSH 为建立在应用层和传输层基础上的安全协议.SSH 是目前较可靠,专 ...

  4. Linux打开防火墙telnet端口

    检查端口情况:netstat -an | grep 22 关闭端口号:iptables -A INPUT -p tcp --drop 端口号-j DROP                    ipt ...

  5. Centos 7中,防火墙配置端口规则

    注意:firewalld服务有两份规则策略配置记录,配置永久生效的策略记录时,需要执行"reload"参数后才能立即生效: Permanent:永久生效的 RunTime:现在正在 ...

  6. centos7 打开mysql 3306端口并 设置外部访问

    mysql安装后默认是localhost访问,如果需要外部访问可以设置一个新的账号把host改为%,意味着所有ip均可以访问 grant all privileges on *.* to 'outUs ...

  7. CentOS7使用firewalld打开关闭防火墙与端口(转载)

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...

  8. 关于学习CentOS7使用firewalld打开关闭防火墙和端口

    1.firewalld简介 firewalld是centos7的一大特点,主要有两个优点:一是支持动态更新,不需要重启服务:二就是加入了防火墙的“zone”概念. firewalld有图形界面和工具界 ...

  9. CentOS7使用httpd apache 和firewalld打开关闭防火墙与端口

    Centos7 使用systemctl 工具操作命令 systemctl 是Centos7的服务管理工具中的主要工具 ,它融合之前service和chkconfig的功能于一体 一.httpd的设置 ...

随机推荐

  1. C++第二章作业

    1.(1)if...else 用法 #include <iostream> #include <cstring> using namespace std; int main() ...

  2. python 录入姓名和成绩, 并且求平均值

    lst = []while 1: a = input("请输入学生的姓名和成绩(姓名_成绩), 输入Q退出录入:") if a.upper() == "Q": ...

  3. 59A

    #include <stdio.h> #include <string.h> #define MAXSIZE 120 int main() { int cntlow=0; in ...

  4. raise error

    raise TypeError("参数q_type 错误 ")

  5. 时区切换导致quartz定时任务没有触发问题

    时区切换对Quartz的cron表达式有影响,切换的1小时内停止触发定时任务,导致sla没有定时清空内存计数,误发限流. 美国夏令时PST切换到冬令时PDT,会有时间跳变.不带时区跳变的,会出现时间重 ...

  6. 实验吧MD5之守株待兔解题思路

    解题链接 http://ctf5.shiyanbar.com/misc/keys/keys.php 解题思路 首先我们多打开几次解题链接,发现系统密钥大约在一秒钟左右变一次,所以联想到时间戳. 解题过 ...

  7. AIX7.1环境打补丁缺少bash OPATCHAUTO-72049

    DB:12.1.0.2.0 RAC OS:AIX 7.1 [To patch only the GI home] su - root export UNZIPPED_PATCH_LOCATION=/o ...

  8. 微信小程序 下拉加载

    在 Page 中定义 onPullDownRefresh 处理函数,监听该页面用户下拉刷新事件. 例: Page({ onPullDownRefresh: function(){ wx.stopPul ...

  9. tensorflow(4)踩过的一些坑

    版本问题 1.1 版本的一个BUG ValueError: Variable rnn/basic_lstm_cell/weights already exists, disallowed. 结合这个文 ...

  10. JS中的闭包(转自他处)

    一.变量的作用域 要理解闭包,首先必须理解Javascript特殊的变量作用域. 变量的作用域无非就是两种:全局变量和局部变量. Javascript语言的特殊之处,就在于函数内部可以直接读取全局变量 ...