linux中ipset命令的使用方法详解

2019-01-16 22:56:45王冬梅

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 moduleSET TARGET的所有选项。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,如果有疑问大家可以留言交流,谢谢大家对易采站长站的支持。

您可能感兴趣的文章:

Linux中date命令转换日期提示date: illegal time format问题解决linux 操作 ftp 常用命令linux下svn版本控制的常用命令大全Linux磁盘格式化命令详解Linux定时执行任务at和crontab命令详解Linux中Git集中操作命令汇总Linux通过sar命令查看网卡流量expect命令在linux下实现批量ssh免密简述Linux文本处理命令“sed”java程序员必须要学会的linux命令总结(推荐)Linux系统利用cp命令实现强制覆盖功能的方法Linux中利用grep命令如何检索文件内容详解详解Linux中两个查找命令locate和find教程Linux十个新手命令分享Linux帮助和用户管理命令Linux企业运维人员常用的150个命令分享Linux中英文命令对应