一、iptables

1、配置

vi /etc/sysconfig/iptables 
-A RH-Firewall-1-INPUT -m state --state NEW -p tcp -m tcp --dport 25 --syn -j ACCEPT
 -- 查找所有规则
iptables -L INPUT --line-numbers -- 删除一条规则
iptables -D INPUT 11 (注意,这个11是行号,是iptables -L INPUT --line-numbers 所打印出来的行号)

  

2、查看状态

service iptables status

3、

Linux防火墙(Iptables)重启系统生效

开启:
chkconfig iptables on 关闭:
chkconfig iptables off

Linux防火墙(Iptables) 即时生效,重启后失效

开启:
service iptables start 关闭:
service iptables stop

iptables还可以用ipset来配置,效率更高

#以下配置,blacklist为一个规则名称
ipset create blacklist hash:ip iptables -I INPUT -m set --match-set blacklist src -j DROP
ipset add blacklist 49.89.251.2
ipset list blacklist
ipset add blacklist 49.89.248.221
ipset add blacklist 27.11.74.167 ipset delete blacklist 1.1.1.1

  

#将ipset规则保存到文件
ipset save blacklist -f blacklist.txt
ipset save whitelist -f whitelist.txt #删除ipset
ipset destroy blacklist
ipset destroy whitelist
#清空ipset
ipset flush blacklist
ipset flush whitelist
#导入ipset规则
ipset restore -f blacklist.txt
ipset restore -f whitelist.txt

  

二、firewalld

1、配置

vi /etc/firewalld/zones/internal.xml
vi /etc/firewalld/zones/public.xml

2、操作

# 启动
systemctl start firewalld #查看状态
systemctl status firewalld #查看状态
firewall-cmd --state #停止
systemctl disable firewalld #禁用
systemctl stop firewalld #更新防火墙规则
firewall-cmd --reload

iptables和firewalld的配置的更多相关文章

  1. netfilter/iptables和firewalld的关系

    1.netfilter 是linux 内核模块,其中包含了大量的内核规则,而要想对这些内核规则进行操作,就需要用户态的工具. iptables和firewalld就是一个用户态的工具. 2.iptab ...

  2. 再谈 iptables 防火墙的 指令配置

    手机上使用localhost为什么不能访问? 电脑上使用localhost 访问主页的原理是 电脑上有网站资源和服务器相关程序apache等的支持, 同时在 电脑的hosts文件中 有 127.0.0 ...

  3. centos7之iptables与firewalld

    保障数据的安全性是继保障数据的可用性之后最为重要的一项工作.防火墙作为公网 与内网之间的保护屏障,在保障数据的安全性方面起着至关重要的作用. firewalld与iptables iptables f ...

  4. 第7章 Iptables与Firewalld防火墙。

    第7章 Iptables与Firewalld防火墙.     Chapter7_听较强节奏的音乐能够让您更长时间的投入在学习中. <Linux就该这么学> 00:00/00:00     ...

  5. 9.Iptables与Firewalld防火墙

    第9章 Iptables与Firewalld防火墙 章节简述: 保障数据的安全性是继保障数据的可用性之后最为重要的一项工作.防火墙作为公网与内网之间的保护屏障,在保障数据的安全性方面起着至关重要的作用 ...

  6. iptables 和firewalld 区别

    在RHEL7里有几种防火墙共存:firewalld.iptables.ebtables,默认是使用firewalld来管理netfilter子系统,不过底层调用的命令仍然是iptables等. fir ...

  7. Linux中的防火墙(Netfilter、Iptables、Firewalld)

    目录 Netfilter Iptables iptables做本地端口转发 Firewalld Netfilter Netfilter是Linux 2.4内核引入的全新的包过滤引擎,位于Linux内核 ...

  8. iptables和firewalld基础

    1.四表五链概念: filter表 过滤数据包 Nat表 用于网络地址转换(IP.端口) Mangle表 修改数据包的服务类型.TTL.并且可以配置路由实现QOS Raw表 决定数据包是否被状态跟踪机 ...

  9. linux iptables常用命令之配置生产环境iptables及优化

    在了解iptables的详细原理之前,我们先来看下如何使用iptables,以终为始,有可能会让你对iptables了解更深 所以接下来我们以配置一个生产环境下的iptables为例来讲讲它的常用命令 ...

随机推荐

  1. [转]Angular CLI 安装和使用

    本文转自:https://www.jianshu.com/p/327d88284abb 一. 背景介绍: 两个概念: 关于Angular版本,Angular官方已经统一命名Angular 1.x统称为 ...

  2. c# 生成验证码图片

    /// <summary> /// 生成验证码图片 /// </summary> /// <returns></returns> public byte ...

  3. Jedis工具类代码

    安装Redis可以参考 https://www.cnblogs.com/dddyyy/p/9763098.html Redis的学习可以参考https://www.cnblogs.com/dddyyy ...

  4. mysql中数据类型后面的数字到底是什么?

    1.在mysql新建数据表的时候我们在数据类型后面经常会见到,或者添加数据,那么数据类型后面的数字到底是什么呢?之前以为int(3) 就代表最长数据就是3个字节,其实不是!! 我向num字段中插入: ...

  5. canvas-star4.html

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. Python: tree data structure

    # 树结构 from pythonds.basic.stack import Stack #pip install pythonds from pythonds.trees.binaryTree im ...

  7. Error running tomcatUnable to open debugger port (127.0.0.1 50181) java.net.B

    1.把tomcat删除,重新建一个,tomcat就会重新自动使用一个端口了 2.自己手动调一下端口 我用的是第二种,手动调了下,最开始的端口是:50181,该成了50182,就可以了.

  8. JS之this应用详解

    目录 1. this作为全局变量2. 作为对象方法的调用3. 作为构造函数调用4. apply调用 this是Javascript语言的一个关键字.它代表函数运行时,自动生成的一个内部对象,只能在函数 ...

  9. “一切都是消息”--iMSF(即时消息服务框架)之【发布-订阅】模式

    MSF的名字是 Message Service Framework 的简称,由于目前框架主要功能在于处理即时(immediately)消息,所以iMSF就是 immediately Message S ...

  10. 在Apex中使用sObject

    sObject对象的定义 Salesforce中的标准对象或自定义对象在Apex中使用时被称作"sObject".sObject对象的一个实例相当于Salesforce中的一条记录 ...