1、firewalld的基本使用
  启动: systemctl start firewalld
  关闭: systemctl stop firewalld
  查看状态: systemctl status firewalld 
  开机禁用  : systemctl disable firewalld
  开机启用  : systemctl enable firewalld
2、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
3、配置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
4、打开一个端口
  添加
  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
 
  查看监听的端口
  netstat -lnpt (PS:centos7默认没有 netstat 命令,需要安装 net-tools 工具,yum install -y net-tools)
  

  检查端口被哪个进程占用

  netstat -lnpt |grep 5672

  

  查看进程的详细信息

  ps 6832

  

  
 

Centos7 中打开和关闭防火墙及端口的更多相关文章

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

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

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

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

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

    CentOS7使用firewalld打开关闭防火墙与端口       1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop ...

  4. CentOS7打开、关闭防火墙。

    CentOS7 以上机器一些命令和低版本CentOS是有些差异的,本文只针对CentOS7 以上版本. CentOS7使用firewalld打开关闭防火墙与端口1.firewalld的基本使用启动: ...

  5. centos7怎么查看、打开和关闭防火墙

    使用centos7会发现,用centos6以前的方式查看.打开和关闭防火墙都无效了.这是因为centos7的防火墙改用firewalld,而不再使用iptables了 查看centos7的防火墙的状态 ...

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

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

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

    http://blog.csdn.net/huxu981598436/article/details/54864260 开启端口命令 输入firewall-cmd --query-port=6379/ ...

  8. centos7 中如何查看、打开、关闭防火墙。

    首先是看centos7的防火墙的状态,查看的命令为: sudo systemctl status firewalld. 查看后,看到active(running)就意味着防火墙打开了, 如果想关闭防火 ...

  9. centos7 开放/关闭防火墙和端口

    --------------------------------------------------------------防火墙----------------------------------- ...

随机推荐

  1. SpringBoot整合Swagger2案例,以及报错:java.lang.NumberFormatException: For input string: ""原因和解决办法

    原文链接:https://blog.csdn.net/weixin_43724369/article/details/89341949 SpringBoot整合Swagger2案例 先说SpringB ...

  2. centos 7上openJdk 安装

    为什么不安装Oracle版本 oracle jdk 现在下载太恶心了会被登陆拦截.于是就安装openjdk. 步骤 下载 yum -y install java-1.8.0-openjdk java- ...

  3. js中的内置方法的兼容写法

    1.如果浏览器不支持every属性,every的实现原理 if(Array.prototype.every===undefined){ Array.prototype.every=function(f ...

  4. Map - 与君初相识

    前言 生活中,我们常会看到这样一种集合:IP地址与主机名,身份证号与个人等,这种一 一对应的关系,就叫做映射.Java提供了专门的集合类用来存放这种对应关系的对象,即 java.util.Map 接口 ...

  5. [poj1062][最短路]昂贵的聘礼

    (最近总是有想让我的小博客更加充实的冲动,遇见一个不平常的题就想写下来.今天这个题姑且算是同学推荐的好题,很有意思,志之) 题目 题面 年轻的探险家来到了一个印第安部落里.在那里他和酋长的女儿相爱了, ...

  6. 利用Python爬取OPGG上英雄联盟英雄胜率及选取率信息

    一.分析网站内容 本次爬取网站为opgg,网址为:” http://www.op.gg/champion/statistics” 由网站界面可以看出,右侧有英雄的详细信息,以Garen为例,胜率为53 ...

  7. 智慧树刷网课python脚本

    0x00 写在前面 疫情期间肯定有很多小伙伴需要上网课,但是有些网课我们感觉十分的鸡肋,自己不感兴趣,又必须要学 所以我写了这个刷网课的小程序,一方面是锻炼自己的爬虫技术,另一方面也给同学们节约宝贵的 ...

  8. Linux进程间通信-eventfd

    Linux进程间通信-eventfd eventfd是linux 2.6.22后系统提供的一个轻量级的进程间通信的系统调用,eventfd通过一个进程间共享的64位计数器完成进程间通信,这个计数器由在 ...

  9. 【Weiss】【第03章】链表例程

    这种基础例程,如之前所提,会有一个实现和一个简单的测试代码. 链表其实没什么可说的,其实包括后面的栈和队列也没什么可说的,直接放代码吧. 下面这个是测试代码 #include <iostream ...

  10. 覆盖io.spring.platform管理的版本号

    使用io.spring.platform时,它会管理各类经过集成测试的依赖版本号.想要覆盖其中某个依赖的版本号个: https://www.cnblogs.com/ld-mars/p/11818252 ...