centos7对防火墙的操作
systemctl status firewalld # 查看防火墙状态
systemctl stop firewalld.service # 停止防火墙
systemctl start firewalld.service # 启动防火墙
systemctl restart firewalld.service # 重启防火墙

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

开放8888端口:

firewall-cmd --zone=public --add-port=8888/tcp --permanent # 开放8888的端口
firewall-cmd --reload # 必须更新防火墙规则
 
关闭8888端口:
firewall-cmd --zone=public --remove-port=80/tcp --permanent  # 关闭80端口的开放
firewall-cmd --reload # 必须更新防火墙规则

  

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

参考:

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
 
那怎么开启一个端口呢
添加
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 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。

操作防火墙-centos7的更多相关文章

  1. CentOS7 开放端口 通过 firewall-cmd 工具来操作防火墙

    CentOS7 提供了 firewall-cmd 工具来操作防火墙. firewall-cmd --permanent:表示设置为持久,配置被写入配置文件,跨重启,不会立即生效,重新加载配置后生效.不 ...

  2. (三) Docker 常用操作与CentOS7 防火墙命令

    参考并感谢 Docker 常用命令 https://docs.docker.com/engine/reference/commandline/docker/ Docker 登录docker账户 doc ...

  3. C#操作防火墙控制电脑某些软件联网

    问题: 目前公司软件刚由单机软件更改为联网软件,许多客户反映希望能够有一个功能来控制电脑上某些必用软件,如qq,公司软件联网,而其他不必要的如网页,游戏等软件不允许联网,于是向公司反映希望可以有一个功 ...

  4. netsh命令操作防火墙

    这里的netsh命令操作防火墙主要是在Windows 7及以上版本,以示例说明: 1.防火墙入方向添加一条规则,规则名字:RDP,协议tcp,动作为允许,端口号3389:简而言之,就是允许其他机器远程 ...

  5. centos7下操作防火墙

    引言 最近使用centos7系统比较频繁,在配置服务器的时候,总是遇到能够ping通服务器,但是就是没有办法访问80端口,这个时候我的直觉告诉我,肯定是防火墙的原因,但是使用iptables却怎么都找 ...

  6. centos7 操作防火墙

    原文:https://blog.csdn.net/u012498149/article/details/78772058 1.firewalld的基本使用 启动: systemctl start fi ...

  7. centos7操作防火墙

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

  8. 防火墙centos7执行 service iptables status报错问题完美解决

    在centos7 执行防火墙命令时 service iptables status 报错如下: 解决方案 : 1.systemctl start firewalld.service(开启防火墙) 2. ...

  9. linux配置防火墙 Centos7下 添加 端口白名单

    最近在阿里云服务器centos7上部署项目 要开启8484端口 , CentOS 7默认使用的是firewall作为防火墙 在firewall下开启端口白名单 1.查看下防火墙的状态:systemct ...

随机推荐

  1. [Linux] ssh-key 公钥文件格式

    SSH 协议(Secure Shell 协议)最初在 1995 年由芬兰的 Tatu Ylönen 设计开发,由 IETF(Internet Engineering Task Force)的网络工作小 ...

  2. JS 对象的深拷贝和浅拷贝

    转载于原文:https://www.cnblogs.com/dabingqi/p/8502932.html 这篇文章是转载于上面的链接地址,觉得写的非常好,所以收藏了,感谢原创作者的分享. 浅拷贝和深 ...

  3. cordova(安卓)(腾讯信鸽注册绑定与反绑定) 插件开发

    腾讯信鸽快速开发指南 http://developer.xg.qq.com/index.php/Android_SDK%E5%BF%AB%E9%80%9F%E6%8C%87%E5%8D%97 本文参考 ...

  4. smarty模板操作变量

    smarty模板技术分配变量的细节问题. 从php中获取数据   一句话:可以分配php支持的各种数据类型. php: 基本数据类型 int double string bool           ...

  5. MFC从资源加载文本

    bool CWizardSheet::GetTextResource(UINT uID, CString& csContent) { HMODULE hModule=GetModuleHand ...

  6. Angular 定时器$timeout和$interval,延时调用

    项目中有用到定时器定时刷新页面的数据,在网上查看了一些资料,整理了一下,备忘. $timeout 用法如下:$timeout(fn,[delay],[invokeApply]); fn:一个将被延迟执 ...

  7. SQL 2017 远程连接被拒绝

    1.防火墙端口 2.数据库要能帐号登录 可是还是不行 打开:SQL Server 2017 配置管理器->SQL Server 服务 ->SQLServer(你的实例名)-> 右键- ...

  8. easyui treegrid 动态展开数据(暂记)

     ClassifyAdminSynMsgSvr.GetCLFLList("<%=CurUTag %>", 1, "", function (ret) ...

  9. CH 1201 - 最大子序和 - [单调队列]

    题目链接:传送门 描述输入一个长度为n的整数序列,从中找出一段不超过m的连续子序列,使得整个序列的和最大. 例如 $1,-3,5,1,-2,3$. 当 $m=4$ 时,$S=5+1-2+3=7$:当 ...

  10. [No0000136]6个重要的.NET概念:栈,堆,值类型,引用类型,装箱,拆箱

    引言 本篇文章主要介绍.NET中6个重要的概念:栈,堆,值类型,引用类型,装箱,拆箱.文章开始介绍当你声明一个变量时,编译器内部发生了什么,然后介绍两个重要的概念:栈和堆:最后介绍值类型和引用类型,并 ...