[root@localhost ~]# yum install iptables -y
[root@localhost ~]# yum install iptables-services

查看安装情况

[root@localhost ~]# rpm -qa|grep iptables
iptables-1.4.21-24.1.el7_5.x86_64
iptables-services-1.4.21-24.1.el7_5.x86_64
修改配置文件

[root@localhost ~]# vi /etc/sysconfig/iptables

#firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended. *filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

保存退出

[root@localhost ~]#systemctl start iptables.service

启动正常,安装成功。

[root@localhost ~]# systemctl enable iptables
[root@localhost ~]# iptables -nv -L --line-number  //查看IP规则 ,--line-number 标上序号

centos下iptables安装的更多相关文章

  1. centos下apache安装后无法访问

    2013.11.28遇到的问题: -------------------------------------- 一.centos下apache安装后无法访问 得查一下防火墙的问题 iptables添加 ...

  2. [转载]centos下yum安装samba及配置

    centos下yum安装samba及配置 在我们使用 Windows 作为客户机的时候,通常有文件.打印共享的需求.作为Windows 网络功能之一,通常可以在 Windows 客户机之间通过Wind ...

  3. centos下编译安装lnmp

    centos下编译安装lnmp 本文以centos为背景在其中编译安装nginx搭建lnmp环境. 编译安装nginx时,需要事先安装 开发包组"Development Tools" ...

  4. CentOS下一键安装Openstack

    CentOS下一键安装Openstack 系统环境:Oracle VirtualBox 4.38CentOS-6.5-x86_64-bin-DVD1.iso 安装前需要修改 /etc/hosts文件, ...

  5. mac和centos下git安装

    mac下面的git安装,这篇文章写的很详细了http://www.cnblogs.com/ccdev/archive/2012/09/12/2682098.html 谈谈centos下的安装.我用的是 ...

  6. centOS下yum安装配置samba

     centOS下yum安装配置samba 2010-03-29 15:46:00 标签:samba yum centOS 安装 休闲 注意:本文的原则是只将文件共享应用于内网服务器,并让将要被共享的目 ...

  7. centos下yum安装crontab+mysql自动备份

    参考博文: centos下yum安装crontab yum install vixie-cron crontabs      //安装 chkconfig crond on               ...

  8. CentOS下Mysql安装教程

    CentOS下Mysql安装教程 本人学习Linux时使用的是CentOs5.5版本,在该环境中,Mysql的安装方法有很多种,下面我只讲我这次成功了的方法,作为一个记录,供大家参考,同时给自己做一个 ...

  9. CentOS下Docker安装

    CentOS下Docker安装 1.安装: #sudo yum install docker 2.启动并加入开机启动: A.#sudo systemctl start docker B.#sudo s ...

随机推荐

  1. request.setCharacterEncoding("utf-8");

    request.setCharacterEncoding("utf-8");不加这句话时,从input控件得到值要用new String(request.getParameter( ...

  2. SpringCloud微服务实战一:Spring Cloud Eureka 服务发现与注册中心(高可用实列为两个注册中心)

    微服务架构: 微服务架构的核心思想是,一个应用是由多个小的.相互独立的.微服务组成,这些服务运行在自己的进程中,开发和发布都没有依赖.不同服务通过一些轻量级交互机制来通信,例如 RPC.HTTP 等, ...

  3. oracle使用dblink跨库查询的例子

    本文介绍了oracle数据库使用dblink进行跨库查询的方法,oracle dblink跨库查询教程,需要的朋友参考下.   oracle dblink跨库查询 方法一:首先,创建数据库链接: 复制 ...

  4. 【洛谷P2907】 【USACO08OPEN】农场周围的道路 水模拟分治

    P2907 [USACO08OPEN]农场周围的道路Roads Around The Farm 题目描述 Farmer John's cows have taken an interest in ex ...

  5. Django基础内容整理

  6. GitHub的注册与使用

    1. 注册账号: 地址: https://github.com/输入账号.邮箱.密码,然后点击注册按钮. 2. 初始设置 注册完成后,选择Free免费账号完成设置 3.验证账号 新建一个仓库 发现邮箱 ...

  7. php thrift TServerSocket实现端口复用

    <?php namespace Message\Controller; use Think\Controller; use Thrift\Exception\TException; use Th ...

  8. IO流1 --- File类的实例化 --- 技术搬运工(尚硅谷)

    构造器1 File(String pathname) //相对路径 File file1 = new File("hello.txt"); //windows绝对路径 File f ...

  9. Codeforces Round #410 (Div. 2) A. Mike and palindrome【判断能否只修改一个字符使其变成回文串】

    A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  10. mysql存储过程小解

    mysql 存储过程 1.创建语法 delimiter $$ --$$表示改变默认的分隔符,代表以下为存储过程,不然会以SQL的方式执行 drop procedure if exists pro_na ...