CentOS 7 版本以上默认的防火墙不是iptables,而是firewalle.

因此CentOS 7 以下的 iptables 的配置不能使用。


查看防火墙状态:

 systemctl status firewalld

 firewall-cmd --state

查看防火墙配置:

 firewall-cmd --list-all

列出所有已开放端口:

 firewall-cmd --zone=public --list-ports

查询端口 8080 是否开放:

 firewall-cmd --query-port=8080/tcp

关闭 | 启动防火墙:

 systemctl start firewalld

 systemctl stop firewalld

关闭开机启动:

 systemctl disable firewalld

开启开机启动:

 systemctl enable firewalld

开启 80 端口

 firewall-cmd --zone=public --add-port=80/tcp --permanent

移除 80 端口

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

上面俩命令需要重新载入配置,才能生效

 firewall-cmd --reload

查看开机自启动的服务列表

 systemctl list-unit-files|grep enabled 

查看监听的端口

 netstat -lntp

检查 80 端口被哪个进程占用

 netstat -lnp|grep 80

CentOS 7 以上防火墙简单配置的更多相关文章

  1. CentOS 7.X 防火墙简单配置

    CentOS7使用的是Linux Kernel 3.10.0的内核版本,新版的Kernel内核已经有了防火墙netfilter,并且使用效能更高,稳定性更好. 配置防火墙的两种方法: 一.使用xml配 ...

  2. 华为USG6000V防火墙简单配置案例

    如图,PC1是企业内网用户,要通过防火墙NAT方式( 1.1.1.105-1.1.1.106 )访问Internet,Server是企业的FTP服务器,通过静态NAT方式供外网用户访问,对外的地址是1 ...

  3. Centos 6\7 防火墙入门配置

    Centos 6 -- iptables iptables 用法: iptables (选项) (参数) 选项: -t<表>:指定要操纵的表: -A:向规则链中添加条目: -D:从规则链中 ...

  4. centos 6.5 samba简单配置

    1.安装samba yum -y install samba  (我的显示已经安装啦!) 2.编辑samba的配置文件 vi /etc/samba/smb.conf 用 testparm查看我配置后的 ...

  5. Centos 安装dhcp及简单配置

    install yum -y install dhcp file /etc/dhcp/dhcpd.conf eg:-------------------------------- ddns-updat ...

  6. Centos 6.5下一个SNMP简单配置(snmp protocol v3,监控宝)

    Centos 6.5下一个SNMP简单配置(snmp protocol v3.监控宝) jom_ch@2014/7/25 1,安装 >yum -y install net-snmp net-sn ...

  7. CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置

    1.安装MariaDB 安装命令 yum -y install mariadb mariadb-server 安装完成MariaDB,首先启动MariaDB,两条命令都可以 systemctl sta ...

  8. Centos7 关于防火墙的一些简单配置

    近期安装了linux系统Centos7,接触下来发现了与原来的Centos6.5有一些差别,这里主要记录下来我的一些关于Centos7防火墙的了解. 一.firewall简介 CentOS 7中防火墙 ...

  9. CentOS 7 防火墙端口配置

    CentOS 7 防火墙端口配置查看防火墙是否开启systemctl status firewalld 若没有开启则开启systemctl start firewalld 查看所有开启的端口firew ...

随机推荐

  1. cf1072D. Minimum path(BFS)

    题意 题目链接 给出一个\(n \times n\)的矩阵,允许修改\(k\)次,求一条从\((1, 1)\)到\((n, n)\)的路径.要求字典序最小 Sol 很显然的一个思路是对于每个点,预处理 ...

  2. js原形对象

    function clock(hour,minute,second){ this.constructor = clock ;//默认实现 /**/ } clock.prototype={ constr ...

  3. java面试题----String、StringBuffer、StringBudder区别

    面试题1 - 什么情况下用+运算符进行字符串连接比调用StringBuffer/StringBuilder对象的append方法连接字符串性能更好? 面试题2 - 请说出下面程序的输出. class ...

  4. 在 Windows Vista、Windows 7 和 Windows Server 2008 上设置 SharePoint 2010 开发环境

    适用范围: SharePoint Foundation 2010 | SharePoint Server 2010 本文内容 步骤 1:选择和预配置操作系统 步骤 2:安装 SharePoint 20 ...

  5. java:反射机制

    Java反射机制及IoC原理:https://www.cnblogs.com/Eason-S/p/5851078.html Java中反射机制详解:https://www.cnblogs.com/wh ...

  6. 4.Zabbix 3.0 案例

    请查看我的有道云笔记: http://note.youdao.com/noteshare?id=2807c0910cd63d309e1462128a31ae0e&sub=241A94E5717 ...

  7. git多站点多用户情况下SSH配置

    个人使用github,但是公司使用的是 GitLab .那么在一个电脑上进行处理时,由于先设置了 github 的,导致没办法从 GitLab 上处理 git .其实是由于 ssh 的问题. 下面记录 ...

  8. POJ-1759 Garland---二分+数学

    题目链接: https://cn.vjudge.net/problem/POJ-1759 题目大意: N个灯泡离地H_i,满足H1 = A ,Hi = (Hi-1 + Hi+1)/2 – 1,HN = ...

  9. 多层感知机训练minist数据集

    MLP .caret, .dropup > .btn > .caret { border-top-color: #000 !important; } .label { border: 1p ...

  10. idea 一次性自动导包

    当复制粘贴一段纯文本代码时,许多类需要导包. 如图 使用optimize imports了,发还是没有办法导入未导入的包,只能删除未使用导包,这跟eclipse不一样,让人很不习惯,查了好多资料都没有 ...