salt.modules.ipset

Support for ipset

salt.modules.ipset.add(set=None, entry=None, family='ipv4', **kwargs)

Append an entry to the specified set.

命令行接口CLI 范例:

salt '*' ipset.add setname 192.168.1.26

salt '*' ipset.add setname 192.168.0.3,AA:BB:CC:DD:EE:FF
salt.modules.ipset.check(set=None, entry=None, family='ipv4')

Check that an entry exists in the specified set.

set
The ipset name
entry

An entry in the ipset. This parameter can be a single IP address, a range of IP addresses, or a subnet block. Example:

192.168.0.1
192.168.0.2-192.168.0.19
192.168.0.0/25
family
IP protocol version: ipv4 or ipv6

命令行接口CLI 范例:

salt '*' ipset.check setname '192.168.0.1 comment "Hello"'
salt.modules.ipset.check_set(set=None, family='ipv4')

Check that given ipset set exists.

2014.7.0 新版功能.

命令行接口CLI 范例:

salt '*' ipset.check_set setname
salt.modules.ipset.delete(set=None, entry=None, family='ipv4', **kwargs)

Delete an entry from the specified set.

命令行接口CLI 范例:

salt '*' ipset.delete setname 192.168.0.3,AA:BB:CC:DD:EE:FF
salt.modules.ipset.delete_set(set=None, family='ipv4')

2014.7.0 新版功能.

Delete ipset set.

命令行接口CLI 范例:

salt '*' ipset.delete_set custom_set

IPv6:
salt '*' ipset.delete_set custom_set family=ipv6
salt.modules.ipset.flush(set=None, family='ipv4')

Flush entries in the specified set, Flush all sets if set is not specified.

命令行接口CLI 范例:

salt '*' ipset.flush

salt '*' ipset.flush set

IPv6:
salt '*' ipset.flush

salt '*' ipset.flush set
salt.modules.ipset.list_sets(family='ipv4')

2014.7.0 新版功能.

List all ipset sets.

命令行接口CLI 范例:

salt '*' ipset.list_sets
salt.modules.ipset.long_range(start, end)
salt.modules.ipset.new_set(set=None, set_type=None, family='ipv4', comment=False, **kwargs)

2014.7.0 新版功能.

Create new custom set

命令行接口CLI 范例:

salt '*' ipset.new_set custom_set list:set

salt '*' ipset.new_set custom_set list:set comment=True

IPv6:
salt '*' ipset.new_set custom_set list:set family=ipv6
salt.modules.ipset.rename_set(set=None, new_set=None, family='ipv4')

2014.7.0 新版功能.

Delete ipset set.

命令行接口CLI 范例:

salt '*' ipset.rename_set custom_set new_set=new_set_name

IPv6:
salt '*' ipset.rename_set custom_set new_set=new_set_name family=ipv6
salt.modules.ipset.test(set=None, entry=None, family='ipv4', **kwargs)

Test if an entry is in the specified set.

命令行接口CLI 范例:

salt '*' ipset.test setname 192.168.0.2

IPv6:
salt '*' ipset.test setname fd81:fc56:9ac7::/48
salt.modules.ipset.version()

Return version from ipset --version

命令行接口CLI 范例:

salt '*' ipset.version