一、防火墙iptables 简洁介绍

iptables 和 firewalld 都是工作在用户空间、用来定义规则的工具,本身不是防火墙,他们定义的规则,可以让内核空间当中的netfilter读取,并且实现防火墙工作。

netfilter是操作系统核心层内部的一个数据包处理模块,它具有如下功能:

  1.网络地址转换 nat

  2.数据包内容修改 mangle

  3.数据包过滤的防火墙功能 filter  

centos7.2  默认使用firewalld ;iptables默认无法被systemctl控制,需要按照iptables-services、iptables-devel这两个依赖包

二、将firewalld切换到 iptables

1. 停止并禁用 firewalld

sudo systemctl stop firewald.service && sudo systemctl disable firewald.service

2.安装iptables-services、iptables-devel

sudo yum install iptables-services iptables-devel

3.启用并启动iptables

sudo systemctl enable iptables.service && sudo systemctl start iptables.service

4.查看iptables配置文件

sudo vim /etc/sysconfig/iptables

5.开启转发功能

(1) 在 /etc/sysctl.conf 中添加 net.ipv4.ip_forward=1

(2) sudo sysctl -p 同步内核参数

(3) 继续查看内核参数 less /proc/sys/net/ipv4/ip_forward  如果为1 则配置生效

Centos7.2 启用iptables的更多相关文章

  1. Centos7防火墙关闭和启用iptables操作

    https://yq.aliyun.com/ziliao/33590前序 还是docker惹得最近做的系统都是上的centos7的系统带来的一系列的新环境的适应 补记下:在使用oracle vmbox ...

  2. centos7 启用iptables

    在centos 7下启用iptables systemctl stop firewalld.service systemctl disable firewalld.service yum instal ...

  3. vsftp被动模式启用iptables访问设置

    vsftpd服务搭建好之后,如果是使用主动模式访问.那么启用iptables只需添加以下规则即可: -A RH-Firewall-1-INPUT -m state --state NEW -m tcp ...

  4. 玩转Linux之- CentOS 7.0,启用iptables防火墙

    原文 玩转Linux之- CentOS 7.0,启用iptables防火墙 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall:sy ...

  5. centos7上安装iptables

    centos7上安装iptables的步骤 注意:CentOS7默认的防火墙不是iptables,而是firewalle. 安装iptable iptable-service #安装iptables ...

  6. Centos7 防火墙关闭和启用iptables防火墙

    操作系统环境:CentOS Linux release 7.0.1406(Core) 64位CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤. 1.关闭f ...

  7. CentOS7关闭默认防火墙启用iptables防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤. 1.关闭firewall: systemctl stop firewalld.service #停止f ...

  8. centos7关闭默认firewall,启用iptables

    CentOS 7.0默认使用"firewall"防火墙 一:关闭firewall1.直接关闭防火墙systemctl stop firewalld.service 2.禁止fire ...

  9. centos7下部署iptables环境纪录(关闭默认的firewalle)(转)

    下面介绍centos7关闭firewall安装iptables,并且开启80端口.3306端口的操作记录:[root@localhost ~]# cat /etc/redhat-release Cen ...

随机推荐

  1. Java 数据类型在实际开发中应用二枚举

    在实际编程中,往往存在着这样的"数据集",它们的数值在程序中是稳定的,而且"数据集"中的元素是有限的.在JDK1.5之前,人们用接口来描述这一种数据类型. 1. ...

  2. nyoj_16:矩形嵌套

    DAG上的动态规划 小技巧:max_element(a, a+n)返回的是数组a从下标0的位置到下标n-1的位置中的n个元素中最大元素的地址. 题目链接: http://acm.nyist.net/J ...

  3. LVS服务原理以及搭建(理论+干货)

    LVS服务原理以及搭建(理论+干货) 版权声明:本文为yunshuxueyuan原创文章 如需转载请标明出处: https://my.oschina.net/yunshuxueyuan/blog QQ ...

  4. struts加载spring

    为了在Struts中加载Spring context,需要在struts-config.xml文件中加入如下部分: <struts-config> <plug-in classNam ...

  5. 安装cocoaPods第三方类库

    *1 检测gem 镜像文件     输入指令: gem sources -l     回车后得到镜像地址.可能是一个,也可能有好几个,常见两个如下 https://rubygems.org/     ...

  6. Hibernate的事务处理机制和flush方法的用法

    关于在使用hibernate在提交事务时常遇到的异常: an assertion failure occured (this may indicate a bug in Hibernate, but ...

  7. if else 和switch case以及continue,break的区别

    1,if 经常用于做区间判断 或者 固定值: break和continue的使用        break:用来结束循环结构或者switch case        continue:结束此次循环进入 ...

  8. AJAX基础_AJAX获取PHP数据

    前言 本篇AJAX基础教程,只讲干货,拒绝废话. 全文通过两个实例来讲解AJAX的基本用法,第1个实例是使用AJAX技术从服务器获取纯文本(HTML)数据, 第2个实例是获取从服务器PHP文件的数据. ...

  9. Hadoop(一)Centos7虚拟机网络配置

    Centos7虚拟机网络配置(桥接模式) 一 VirtualBox提供了三种工作模式,它们是bridged(桥接模式).NAT(网络地址转换模式)和host-only(主机模式). 1 桥接模式(br ...

  10. js prototype 继承

    //继承 function inherits(ctor,superCtor){ ctor.super_ = superCtor; ctor.prototype = Object.create(supe ...