1. CentOS7默认使用的是firewalld而不是之前的iptables。需要先停用firewalld.

    systemctl stop firewalld
  2. 安装  iptables 服务
    yum -y install iptables
  3. 查看当前开放端口
    iptables  -nL --line-number
  4. 修改iptables文件
    vi  /etc/sysconfig/iptables

    添加如下文字(开启80端口)

    *filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
    -A INPUT -j REJECT --reject-with icmp-host-prohibited
    -A FORWARD -j REJECT --reject-with icmp-host-prohibited
    COMMIT
  5. 重启iptables服务
    systemctl restart iptables

CentOS7防火墙设置--iptables的更多相关文章

  1. centos7防火墙设置

    前言 CentOS7 与之前版本在防火墙配置上不同,防火墙从iptables变成了firewalld Centos7默认安装了firewalld,如果没有安装的话,可以使用yum命令进行安装 yum ...

  2. Centos6与Centos7防火墙设置与端口开放的方法

    Centos升级到7之后,内置的防火墙已经从iptables变成了firewalld.所以,端口的开启还是要从两种情况来说明的,即iptables和firewalld.更多关于CentOs防火墙的最新 ...

  3. Centos6,Centos7防火墙设置与端口开放的方法

    Centos升级到7之后,内置的防火墙已经从iptables变成了firewalld.端口的开启还是要从两种情况来说明的,即iptables和firewalld. 一.iptables 1.打开/关闭 ...

  4. Linux防火墙设置——iptables

    防火墙用于监控往来流量,并根据用户定义的规则来过滤数据包以保证安全.iptables是Linux下设置防火墙规则的常用工具,它可以让你设置.维护以及查看防火墙的规则表.你可以定义多个表,每个表可以包含 ...

  5. CentOS7防火墙设置常用命令

    目录 开/关/重启防火墙 查看所有开启的端口号 CentOS7环境下防火墙常用命令 开/关/重启防火墙 查看防火墙状态 firewall-cmd --state 启动防火墙 systemctl sta ...

  6. CentOS7 防火墙设置

    CentOS7 防火墙命令 最近在公司服务器上安装了oracle12c数据库,在用数据库客户端连接的时候,连接不了.最后查找资料的原因是因为oracle的服务端口未开放. 首先还是还是输入以往的开启某 ...

  7. CentOS7——防火墙设置

    1.查看firewall服务状态 systemctl status firewalld 2.查看firewall的状态firewall-cmd --state 3.开启.重启.关闭.firewalld ...

  8. Linux centos7 防火墙设置

    1.查看防火墙状态 systemctl list-unit-files|grep firewalld.service 或 systemctl status firewalld.service 2.开启 ...

  9. CentOS7安装配置iptables防火墙

    转载请注明出处:http://blog.csdn.net/l1028386804/article/details/50779761 CentOS7默认的防火墙不是iptables,而是firewall ...

随机推荐

  1. MongoDB 操作手冊CRUD 删除 remove

    删除记录 概述 在MongoDB中,db.collection.remove()方法用于删除集合中的记录.能够删除全部记录,删除全部符合条件的记录.或者是仅删除一条记录. 删除全部记录 删除一个集合中 ...

  2. 资源管理器也玩多标签:QT TabBar v1.5.0.0a3

    http://zmingcx.com/explorer-also-play-more-tags-qt-tabbar-v1-5-0-0a3.html浏览器中的标签浏览功能非常受欢迎,安装QT TabBa ...

  3. git diff 文件对比

    1.  git diff  filepath 工作区与暂存区比较 2. git diff HEAD filepath 工作区与HEAD ( 当前工作分支) 比较 3. git diff --stage ...

  4. python--getattr函数

    getattr函数原型 getattr(object, name[, default]) -> value getattr是功能就是获取object对象的name属性的值(object.name ...

  5. visual studio 2017无建模项目?

    教一跨行同事学C#,我想从基础的讲一下,也就是最基本的面象对象分析与设计(OOAD),我直接打开我最新安装的 visual studio 2017.准备建一个“建模项目”.结果发现死活找不到?打开一个 ...

  6. Mono源码学习笔记:Console类(三)

    Buffer 类 (public static class) 以下就是 mcs/class/corlib/System/Buffer.cs: 001: // 002: // System.Buffer ...

  7. CvSplit

    /* possible split in the tree */ typedef struct CvSplit { CvTreeCascadeNode* parent; CvTreeCascadeNo ...

  8. 1.文件I/O

    一. open()&close() #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h& ...

  9. C#Lpt端口打印类的操作浅析

    C#LPT端口打印类的操作是什么呢?首先让我们看看什么是LPT端口(打印机专用)?LPT端口是一种增强了的双向并行传输接口,在USB接口出现以前是扫描仪,打印机最常用的接口.最高传输速度为1.5Mbp ...

  10. pair + map 函数结合使用

    题目链接:codeforces 44A5birch yellowmaple redbirch yellowmaple yellowmaple green 4 3oak yellowoak yellow ...