ipsec linux_linux文件复制命令

ipsec linux_linux文件复制命令ipset介绍iptables是在linux内核里配置防火墙规则的用户空间工具,它实际上是netfilter框架的一部分.可能因为iptables是netfilter框架里最常见的部分,所以这个框架通常被称为iptables,iptables是linux从2.4版本引入的防火墙解决方案.ipset是iptables的扩展,它允许你创建匹配整个地址sets(地址集合)的规则。而不像普通的ipta…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

ipset介绍

iptables是在linux内核里配置防火墙规则的用户空间工具,它实际上是netfilter框架的一部分.可能因为iptables是netfilter框架里最常见的部分,所以这个框架通常被称为iptables,iptables是linux从2.4版本引入的防火墙解决方案.

ipset是iptables的扩展,它允许你创建 匹配整个地址sets(地址集合) 的规则。而不像普通的iptables链是线性的存储和过滤,ip集合存储在带索引的数据结构中,这种结构即时集合比较大也可以进行高效的查找.

除了一些常用的情况,比如阻止一些危险主机访问本机,从而减少系统资源占用或网络拥塞,IPsets也具备一些新防火墙设计方法,并简化了配置.

官网:http://ipset.netfilter.org/

安装rpm -ivh libmnl-devel-1.0.2-3.el6.x86_64.rpm libmnl-1.0.2-3.el6.x86_64.rpm

tar xvf ipset-6.24.tar.bz2

cd ipset-6.24

./configure

make

make install

#注意:

如果在centos6.6或其他情况下安装时候,configure报错如下configure: error: Invalid kernel source directory /lib/modules/2.6.32-358.el6.x86_64/source

解决:需要安装内核源码包kernel-devel-2.6.32-358.el6.x86_64.rpm

创建ipset

ipset -n或者ipset create:n, create SETNAME TYPENAME [ CREATE-OPTIONS ]

SETNAME是创建的ipset的名称,TYPENAME是ipset的类型:TYPENAME := method:datatype[,datatype[,datatype]]

method指定ipset中的entry存放的方式,随后的datatype约定了每个entry的格式。

可以使用的method:bitmap, hash, list

可以使用的datatype:ip, net, mac, port, iface

添加记录

ipset add用于在ipset中添加记录:add SETNAME ADD-ENTRY [ ADD-OPTIONS ]

向ipset中添加entry的时候,加入的entry的格式必须与创建ipset是指定的格式匹配。$ipset creat foo hash:ip,port,ip

$ipset add foo ipaddr,portnum,ipaddr

$ipset list foo

Name: foo

Type: hash:ip,port,ip

Revision: 2

Header: family inet hashsize 1024 maxelem 65536

Size in memory: 16584

References: 0

Members:

192.168.1.2,tcp:80,192.168.1.3

删除记录

ipset del用于从ipset中删除记录:del SETNAME DEL-ENTRY [ DEL-OPTIONS ]

查询记录

ipset test可以检查目标entry是否在ipset中:test SETNAME TEST-ENTRY [ TEST-OPTIONS ]

ipset list可以查看ipset的所有内容:list [ SETNAME ] [ OPTIONS ]

导出导入

ipset save可以导出所有的ipset:save [ SETNAME ]

ipset restore则用于将导出的内容导入。

其它flush [ SETNAME ]

Flush all entries from the specified set or flush all sets if none is given.

e, rename SETNAME-FROM SETNAME-TO

Rename a set. Set identified by SETNAME-TO must not exist.

w, swap SETNAME-FROM SETNAME-TO

Swap the content of two sets, or in another words, exchange the name of two sets. The referred sets must exist and identical type of sets can be swapped only.

help [ TYPENAME ]

Print help and set type specific help if TYPENAME is specified.

version

Print program version.

–  If a dash is specified as command, then ipset enters a simple interactive mode and the commands are read from the standard input. The interactive mode can be finished by entering the

pseudo-command quit.

在iptables中使用ipset

在iptables中可以使用-m set启用ipset模块,例如。-A POSTROUTING -m set –match-set felix-masq-ipam-pools src -m set ! –match-set felix-all-ipam-pools dst -j MASQUERADE

iptables的set模块:set

This module matches IP sets which can be defined by ipset(8).

[!] –match-set setname flag[,flag]…

where flags are the comma separated list of src and/or dst specifications and there can be no more than six of them. Hence the command

iptables -A FORWARD -m set –match-set test src,dst

在TARGET中也可以操作ipset:SET

This module adds and/or deletes entries from IP sets which can be defined by ipset(8).

–add-set setname flag[,flag…]

add the address(es)/port(s) of the packet to the set

–del-set setname flag[,flag…]

delete the address(es)/port(s) of the packet from the set

where flag(s) are src and/or dst specifications and there can be no more than six of them.

在man iptables-extensions中可以找到set module和SET TARGET的所有选项。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/184977.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 一文看懂YOLO v3

    一文看懂YOLO v3论文地址:https://pjreddie.com/media/files/papers/YOLOv3.pdf论文:YOLOv3:AnIncrementalImprovementYOLO系列的目标检测算法可以说是目标检测史上的宏篇巨作,接下来我们来详细介绍一下YOLOv3算法内容,v3的算法是在v1和v2的基础上形成的,所以有必要先回忆:一文看懂YOLOv2,一文看懂YOLOv2…

    2022年6月29日
    29
  • uchar什么类型_char的用法举例

    uchar什么类型_char的用法举例char和uchar区别 char是有符号的,uchar(unsignedchar)是无符号的! 1、作为字符来表示的话,两者没有什么区别!2、作为整数来表示的话,由于char是有符号的,于是数值范围为-12…

    2022年4月19日
    214
  • batchNorm解析「建议收藏」

    batchNorm解析「建议收藏」转载:基础|batchnorm原理及代码详解Batchnorm原理详解前言:Batchnorm是深度网络中经常用到的加速神经网络训练,加速收敛速度及稳定性的算法,可以说是目前深度网络必不可少的一部分。本文旨在用通俗易懂的语言,对深度学习的常用算法–batchnorm的原理及其代码实现做一个详细的解读。本文主要包括以下几个部分。Batchnorm主要解决的问题Batchnorm…

    2022年5月6日
    47
  • mle与map_normal map

    mle与map_normal map摘要本文是关于MLE(最大似然估计)与MAP(最大后验概率)的一些自己学习的心得.(本文的重点在于对比MLE和MAP)正文1.MLE(最大似然估计)MLE简单的理解可以这样:假设我们手上有一批数据(样本),而且我们假设这些数据(样本)服从某个分布(模型已知),但是参数未知.这个时候,我们希望对这个参数进行估计,而MLE的思想就是找到一个参数值,使得每条样本出现的概率最…

    2025年6月19日
    3
  • 百度搜索内容无法打开(百度好多网页打不开怎么回事)

    写在开头补充:1.如果出现“您连接的不是私密连接”请点击【高级】或者【详细】;(针对火狐浏览器与谷歌浏览器)2.如果是访问“http://www.baidu.com”不行,请替换“https://www.baidu.com”试试;打不开百度首页问题,只有百度打不开其他能打开怎么办?问题汇总描述1.谷歌Chrome浏览器有时候打不开百度,其它网站表示能够正常访问;2.360浏览器打开…

    2022年4月17日
    1.6K

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号