bitmap:ip
The bitmap:ip set type uses a memory range to store either IPv4 host (default) or IPv4 network addresses.
A bitmap:ip type of set can store up to 65536 entries.
CREATE-OPTIONS := rangefromip-toip|ip/cidr [ netmaskcidr ] [ timeoutvalue ] [ counters ] [ comment ] [
skbinfo ]
ADD-ENTRY := { ip | fromip-toip | ip/cidr }
ADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := { ip | fromip-toip | ip/cidr }
TEST-ENTRY := ip
Mandatory create options:
rangefromip-toip|ip/cidr
Create the set from the specified inclusive address range expressed in an IPv4 address range or
network. The size of the range (in entries) cannot exceed the limit of maximum 65536 elements.
Optional create options:
netmaskcidr
When the optional netmask parameter specified, network addresses will be stored in the set instead
of IP host addresses. The cidr prefix value must be between 1-32. An IP address will be in the
set if the network address, which is resulted by masking the address with the specified netmask,
can be found in the set.
The bitmap:ip type supports adding or deleting multiple entries in one command.
Examples:
ipset create foo bitmap:ip range 192.168.0.0/16
ipset add foo 192.168.1/24
ipset test foo 192.168.1.1
bitmap:ip,mac
The bitmap:ip,mac set type uses a memory range to store IPv4 and a MAC address pairs. A bitmap:ip,mac
type of set can store up to 65536 entries.
CREATE-OPTIONS := rangefromip-toip|ip/cidr [ timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := ip[,macaddr]
ADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := ip[,macaddr]
TEST-ENTRY := ip[,macaddr]
Mandatory options to use when creating a bitmap:ip,mac type of set:
rangefromip-toip|ip/cidr
Create the set from the specified inclusive address range expressed in an IPv4 address range or
network. The size of the range cannot exceed the limit of maximum 65536 entries.
The bitmap:ip,mac type is exceptional in the sense that the MAC part can be left out when
adding/deleting/testing entries in the set. If we add an entry without the MAC address specified, then
when the first time the entry is matched by the kernel, it will automatically fill out the missing MAC
address with the MAC address from the packet. The source MAC address is used if the entry matched due to
a src parameter of the set match, and the destination MAC address is used if available and the entry
matched due to a dst parameter. If the entry was specified with a timeout value, the timer starts off
when the IP and MAC address pair is complete.
The bitmap:ip,mac type of sets require two src/dst parameters of the set match and SET target netfilter
kernel modules. For matches on destination MAC addresses, see COMMENTS below.
Examples:
ipset create foo bitmap:ip,mac range 192.168.0.0/16
ipset add foo 192.168.1.1,12:34:56:78:9A:BC
ipset test foo 192.168.1.1
bitmap:port
The bitmap:port set type uses a memory range to store port numbers and such a set can store up to 65536
ports.
CREATE-OPTIONS := rangefromport-toport[timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := { [proto:]port | [proto:]fromport-toport }
ADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := { [proto:]port | [proto:]fromport-toport }
TEST-ENTRY := [proto:]port
Mandatory options to use when creating a bitmap:port type of set:
range[proto:]fromport-toport
Create the set from the specified inclusive port range.
The set match and SET target netfilter kernel modules interpret the stored numbers as TCP or UDP port
numbers.
proto only needs to be specified if a service name is used and that name does not exist as a TCP service.
The protocol is never stored in the set, just the port number of the service.
Examples:
ipset create foo bitmap:port range 0-1024
ipset add foo 80
ipset test foo 80
ipset del foo udp:[macon-udp]-[tn-tl-w2]
hash:ip
The hash:ip set type uses a hash to store IP host addresses (default) or network addresses. Zero valued
IP address cannot be stored in a hash:ip type of set.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
netmaskcidr ] [ bitmaskmask ] [ timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := ipaddrADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := ipaddrTEST-ENTRY := ipaddr
Optional create options:
netmaskcidr
When the optional netmask parameter specified, network addresses will be stored in the set instead
of IP host addresses. The cidr prefix value must be between 1-32 for IPv4 and between 1-128 for
IPv6. An IP address will be in the set if the network address, which is resulted by masking the
address with the netmask, can be found in the set. Examples:
ipset create foo hash:ip netmask 30
ipset add foo 192.168.1.0/24
ipset test foo 192.168.1.2
bitmaskmask
This works similar to netmask but it will accept any valid IPv4/v6 address. It does not have to be
a valid netmask.
hash:mac
The hash:mac set type uses a hash to store MAC addresses. Zero valued MAC addresses cannot be stored in a
hash:mac type of set. For matches on destination MAC addresses, see COMMENTS below.
CREATE-OPTIONS := [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [ timeoutvalue ] [ counters
] [ comment ] [ skbinfo ]
ADD-ENTRY := macaddrADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := macaddrTEST-ENTRY := macaddr
Examples:
ipset create foo hash:mac
ipset add foo 01:02:03:04:05:06
ipset test foo 01:02:03:04:05:06
hash:ip,mac
The hash:ip,mac set type uses a hash to store IP and a MAC address pairs. Zero valued MAC addresses
cannot be stored in a hash:ip,mac type of set. For matches on destination MAC addresses, see COMMENTS
below.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := ipaddr,macaddrADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := ipaddr,macaddrTEST-ENTRY := ipaddr,macaddr
Examples:
ipset create foo hash:ip,mac
ipset add foo 1.1.1.1,01:02:03:04:05:06
ipset test foo 1.1.1.1,01:02:03:04:05:06
hash:net
The hash:net set type uses a hash to store different sized IP network addresses. Network address with
zero prefix size cannot be stored in this type of sets.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := netaddrADD-OPTIONS := [ timeoutvalue ] [ nomatch ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [
skbmarkvalue ] [ skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := netaddrTEST-ENTRY := netaddr
where netaddr := ip[/cidr]
When adding/deleting/testing entries, if the cidr prefix parameter is not specified, then the host prefix
value is assumed. When adding/deleting entries, the exact element is added/deleted and overlapping
elements are not checked by the kernel. When testing entries, if a host address is tested, then the
kernel tries to match the host address in the networks added to the set and reports the result
accordingly.
From the set netfilter match point of view the searching for a match always starts from the smallest
size of netblock (most specific prefix) to the largest one (least specific prefix) added to the set.
When adding/deleting IP addresses to the set by the SET netfilter target, it will be added/deleted by
the most specific prefix which can be found in the set, or by the host prefix value if the set is empty.
The lookup time grows linearly with the number of the different prefix values added to the set.
Example:
ipset create foo hash:net
ipset add foo 192.168.0.0/24
ipset add foo 10.1.0.0/16
ipset add foo 192.168.0/24
ipset add foo 192.168.0/30 nomatch
When matching the elements in the set above, all IP addresses will match from the networks
192.168.0.0/24, 10.1.0.0/16 and 192.168.0/24 except the ones from 192.168.0/30.
hash:net,net
The hash:net,net set type uses a hash to store pairs of different sized IP network addresses. Bear in
mind that the first parameter has precedence over the second, so a nomatch entry could be potentially
be ineffective if a more specific first parameter existed with a suitable second parameter. Network
address with zero prefix size cannot be stored in this type of set.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
netmaskcidr ] [ bitmaskmask ] [ timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := netaddr,netaddrADD-OPTIONS := [ timeoutvalue ] [ nomatch ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [
skbmarkvalue ] [ skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := netaddr,netaddrTEST-ENTRY := netaddr,netaddr
where netaddr := ip[/cidr]
When adding/deleting/testing entries, if the cidr prefix parameter is not specified, then the host prefix
value is assumed. When adding/deleting entries, the exact element is added/deleted and overlapping
elements are not checked by the kernel. When testing entries, if a host address is tested, then the
kernel tries to match the host address in the networks added to the set and reports the result
accordingly.
From the set netfilter match point of view the searching for a match always starts from the smallest
size of netblock (most specific prefix) to the largest one (least specific prefix) with the first param
having precedence. When adding/deleting IP addresses to the set by the SET netfilter target, it will
be added/deleted by the most specific prefix which can be found in the set, or by the host prefix
value if the set is empty.
The lookup time grows linearly with the number of the different prefix values added to the first
parameter of the set. The number of secondary prefixes further increases this as the list of secondary
prefixes is traversed per primary prefix.
Optional create options:
netmaskcidr
When the optional netmask parameter specified, network addresses will be stored in the set instead
of IP host addresses. The cidr prefix value must be between 1-32 for IPv4 and between 1-128 for
IPv6. An IP address will be in the set if the network address, which is resulted by masking the
address with the netmask, can be found in the set.
bitmaskmask
This works similar to netmask but it will accept any valid IPv4/v6 address. It does not have to be
a valid netmask.
Example:
ipset create foo hash:net,net
ipset add foo 192.168.0.0/24,10.0.1.0/24
ipset add foo 10.1.0.0/16,10.255.0.0/24
ipset add foo 192.168.0/24,192.168.54.0-192.168.54.255
ipset add foo 192.168.0/30,192.168.64/30 nomatch
When matching the elements in the set above, all IP addresses will match from the networks
192.168.0.0/24<->10.0.1.0/24, 10.1.0.0/16<->10.255.0.0/24 and 192.168.0/24<->192.168.54.0/24 except the
ones from 192.168.0/30<->192.168.64/30.
hash:ip,port
The hash:ip,port set type uses a hash to store IP address and port number pairs. The port number is
interpreted together with a protocol (default TCP) and zero protocol number cannot be used.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
netmaskcidr ] [ bitmaskmask ] [ timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := ipaddr,[proto:]portADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := ipaddr,[proto:]portTEST-ENTRY := ipaddr,[proto:]port
The [proto:]port part of the elements may be expressed in the following forms, where the range variations
are valid when adding or deleting entries:
portname[-portname]
TCP port or range of ports expressed in TCP portname identifiers from /etc/servicesportnumber[-portnumber]
TCP port or range of ports expressed in TCP port numbers
tcp|sctp|udp|udplite:portname|portnumber[-portname|portnumber]
TCP, SCTP, UDP or UDPLITE port or port range expressed in port name(s) or port number(s)
icmp:codename|type/code
ICMP codename or type/code. The supported ICMP codename identifiers can always be listed by the
help command.
icmpv6:codename|type/code
ICMPv6 codename or type/code. The supported ICMPv6 codename identifiers can always be listed by
the help command.
proto:0
All other protocols, as an identifier from /etc/protocols or number. The pseudo port number must
be zero.
The hash:ip,port type of sets require two src/dst parameters of the set match and SET target kernel
modules.
Optional create options:
netmaskcidr
When the optional netmask parameter specified, network addresses will be stored in the set instead
of IP host addresses. The cidr prefix value must be between 1-32 for IPv4 and between 1-128 for
IPv6. An IP address will be in the set if the network address, which is resulted by masking the
address with the netmask, can be found in the set.
bitmaskmask
This works similar to netmask but it will accept any valid IPv4/v6 address. It does not have to be
a valid netmask.
Examples:
ipset create foo hash:ip,port
ipset add foo 192.168.1.0/24,80-82
ipset add foo 192.168.1.1,udp:53
ipset add foo 192.168.1.1,vrrp:0
ipset test foo 192.168.1.1,80
hash:net,port
The hash:net,port set type uses a hash to store different sized IP network address and port pairs. The
port number is interpreted together with a protocol (default TCP) and zero protocol number cannot be
used. Network address with zero prefix size is not accepted either.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := netaddr,[proto:]portADD-OPTIONS := [ timeoutvalue ] [ nomatch ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [
skbmarkvalue ] [ skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := netaddr,[proto:]portTEST-ENTRY := netaddr,[proto:]port
where netaddr := ip[/cidr]
For the netaddr part of the elements see the description at the hash:net set type. For the [proto:]port
part of the elements see the description at the hash:ip,port set type.
When adding/deleting/testing entries, if the cidr prefix parameter is not specified, then the host prefix
value is assumed. When adding/deleting entries, the exact element is added/deleted and overlapping
elements are not checked by the kernel. When testing entries, if a host address is tested, then the
kernel tries to match the host address in the networks added to the set and reports the result
accordingly.
From the set netfilter match point of view the searching for a match always starts from the smallest
size of netblock (most specific prefix) to the largest one (least specific prefix) added to the set.
When adding/deleting IP addresses to the set by the SET netfilter target, it will be added/deleted by
the most specific prefix which can be found in the set, or by the host prefix value if the set is empty.
The lookup time grows linearly with the number of the different prefix values added to the set.
Examples:
ipset create foo hash:net,port
ipset add foo 192.168.0/24,25
ipset add foo 10.1.0.0/16,80
ipset test foo 192.168.0/24,25
hash:ip,port,ip
The hash:ip,port,ip set type uses a hash to store IP address, port number and a second IP address
triples. The port number is interpreted together with a protocol (default TCP) and zero protocol number
cannot be used.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := ipaddr,[proto:]port,ipADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := ipaddr,[proto:]port,ipTEST-ENTRY := ipaddr,[proto:]port,ip
For the first ipaddr and [proto:]port parts of the elements see the descriptions at the hash:ip,port set
type.
The hash:ip,port,ip type of sets require three src/dst parameters of the set match and SET target kernel
modules.
Examples:
ipset create foo hash:ip,port,ip
ipset add foo 192.168.1.1,80,10.0.0.1
ipset test foo 192.168.1.1,udp:53,10.0.0.1
hash:ip,port,net
The hash:ip,port,net set type uses a hash to store IP address, port number and IP network address
triples. The port number is interpreted together with a protocol (default TCP) and zero protocol number
cannot be used. Network address with zero prefix size cannot be stored either.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := ipaddr,[proto:]port,netaddrADD-OPTIONS := [ timeoutvalue ] [ nomatch ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [
skbmarkvalue ] [ skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := ipaddr,[proto:]port,netaddrTEST-ENTRY := ipaddr,[proto:]port,netaddr
where netaddr := ip[/cidr]
For the ipaddr and [proto:]port parts of the elements see the descriptions at the hash:ip,port set type.
For the netaddr part of the elements see the description at the hash:net set type.
From the set netfilter match point of view the searching for a match always starts from the smallest
size of netblock (most specific cidr) to the largest one (least specific cidr) added to the set. When
adding/deleting triples to the set by the SET netfilter target, it will be added/deleted by the most
specific cidr which can be found in the set, or by the host cidr value if the set is empty.
The lookup time grows linearly with the number of the different cidr values added to the set.
The hash:ip,port,net type of sets require three src/dst parameters of the set match and SET target kernel
modules.
Examples:
ipset create foo hash:ip,port,net
ipset add foo 192.168.1,80,10.0.0/24
ipset add foo 192.168.2,25,10.1.0.0/16
ipset test foo 192.168.1,80.10.0.0/24
hash:ip,mark
The hash:ip,mark set type uses a hash to store IP address and packet mark pairs.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ markmaskvalue ] [ hashsizevalue ] [ maxelemvalue ] [
bucketsizevalue ] [ timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := ipaddr,markADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := ipaddr,markTEST-ENTRY := ipaddr,mark
Optional create options:
markmaskvalue
Allows you to set bits you are interested in the packet mark. This values is then used to perform
bitwise AND operation for every mark added. markmask can be any value between 1 and 4294967295,
by default all 32 bits are set.
The mark can be any value between 0 and 4294967295.
The hash:ip,mark type of sets require two src/dst parameters of the set match and SET target kernel
modules.
Examples:
ipset create foo hash:ip,mark
ipset add foo 192.168.1.0/24,555
ipset add foo 192.168.1.1,0x63
ipset add foo 192.168.1.1,111236
hash:net,port,net
The hash:net,port,net set type behaves similarly to hash:ip,port,net but accepts a cidr value for both
the first and last parameter. Either subnet is permitted to be a /0 should you wish to match port between
all destinations.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := netaddr,[proto:]port,netaddrADD-OPTIONS := [ timeoutvalue ] [ nomatch ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [
skbmarkvalue ] [ skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := netaddr,[proto:]port,netaddrTEST-ENTRY := netaddr,[proto:]port,netaddr
where netaddr := ip[/cidr]
For the [proto:]port part of the elements see the description at the hash:ip,port set type. For the
netaddr part of the elements see the description at the hash:net set type.
From the set netfilter match point of view the searching for a match always starts from the smallest
size of netblock (most specific cidr) to the largest one (least specific cidr) added to the set. When
adding/deleting triples to the set by the SET netfilter target, it will be added/deleted by the most
specific cidr which can be found in the set, or by the host cidr value if the set is empty. The first
subnet has precedence when performing the most-specific lookup, just as for hash:net,net
The lookup time grows linearly with the number of the different cidr values added to the set and by the
number of secondary cidr values per primary.
The hash:net,port,net type of sets require three src/dst parameters of the set match and SET target
kernel modules.
Examples:
ipset create foo hash:net,port,net
ipset add foo 192.168.1.0/24,0,10.0.0/24
ipset add foo 192.168.2.0/24,25,10.1.0.0/16
ipset test foo 192.168.1.1,80,10.0.0.1
hash:net,iface
The hash:net,iface set type uses a hash to store different sized IP network address and interface name
pairs.
CREATE-OPTIONS := [ family { inet | inet6 } ] [ hashsizevalue ] [ maxelemvalue ] [ bucketsizevalue ] [
timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := netaddr,[physdev:]ifaceADD-OPTIONS := [ timeoutvalue ] [ nomatch ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [
skbmarkvalue ] [ skbpriovalue ] [ skbqueuevalue ] [ wildcard ]
DEL-ENTRY := netaddr,[physdev:]ifaceTEST-ENTRY := netaddr,[physdev:]iface
where netaddr := ip[/cidr]
For the netaddr part of the elements see the description at the hash:net set type.
When adding/deleting/testing entries, if the cidr prefix parameter is not specified, then the host prefix
value is assumed. When adding/deleting entries, the exact element is added/deleted and overlapping
elements are not checked by the kernel. When testing entries, if a host address is tested, then the
kernel tries to match the host address in the networks added to the set and reports the result
accordingly.
From the set netfilter match point of view the searching for a match always starts from the smallest
size of netblock (most specific prefix) to the largest one (least specific prefix) added to the set.
When adding/deleting IP addresses to the set by the SET netfilter target, it will be added/deleted by
the most specific prefix which can be found in the set, or by the host prefix value if the set is empty.
The second direction parameter of the set match and SET target modules corresponds to the
incoming/outgoing interface: src to the incoming one (similar to the -i flag of iptables), while dst to
the outgoing one (similar to the -o flag of iptables). When the interface is flagged with physdev:, the
interface is interpreted as the incoming/outgoing bridge port.
The lookup time grows linearly with the number of the different prefix values added to the set.
The internal restriction of the hash:net,iface set type is that the same network prefix cannot be stored
with more than 64 different interfaces in a single set.
Examples:
ipset create foo hash:net,iface
ipset add foo 192.168.0/24,eth0
ipset add foo 10.1.0.0/16,eth1
ipset test foo 192.168.0/24,eth0
list:set
The list:set type uses a simple list in which you can store set names.
CREATE-OPTIONS := [ sizevalue ] [ timeoutvalue ] [ counters ] [ comment ] [ skbinfo ]
ADD-ENTRY := setname [ { before | after } setname ]
ADD-OPTIONS := [ timeoutvalue ] [ packetsvalue ] [ bytesvalue ] [ commentstring ] [ skbmarkvalue ] [
skbpriovalue ] [ skbqueuevalue ]
DEL-ENTRY := setname [ { before | after } setname ]
TEST-ENTRY := setname [ { before | after } setname ]
Optional create options:
sizevalue
The size of the list, the default is 8. The parameter is ignored since ipset version 6.24.
By the ipset command you can add, delete and test set names in a list:set type of set.
By the set match or SET target of netfilter you can test, add or delete entries in the sets added to the
list:set type of set. The match will try to find a matching entry in the sets and the target will try to
add an entry to the first set to which it can be added. The number of direction options of the match and
target are important: sets which require more parameters than specified are skipped, while sets with
equal or less parameters are checked, elements added/deleted. For example if a and b are list:set type of
sets then in the command
iptables -m set --match-set a src,dst -j SET --add-set b src,dst
the match and target will skip any set in a and b which stores data triples, but will match all sets with
single or double data storage in a set and stop matching at the first successful set, and add src to the
first single or src,dst to the first double data storage set in b to which the entry can be added. You
can imagine a list:set type of set as an ordered union of the set elements.
Please note: by the ipset command you can add, delete and test the setnames in a list:set type of set,
and not the presence of a set's member (such as an IP address).
Comments
If you want to store same size subnets from a given network (say /24 blocks from a /8 network), use the bitmap:ip set type. If you want to store random same size networks (say random /24 blocks), use the hash:ip set type. If you have got random size of netblocks, use hash:net. Matching on destination MAC addresses using the dst parameter of the set match netfilter kernel modules will only work if the destination MAC address is available in the packet at the given processing stage, that is, it only applies for incoming packets in the PREROUTING, INPUT and FORWARD chains, against the MAC address as originally found in the received packet (typically, one of the MAC addresses of the local host). This is not the destination MAC address a destination IP address resolves to, after routing. If the MAC address is not available (e.g. in the OUTPUT chain), the packet will simply not match. Backward compatibility is maintained and old ipset syntax is still supported. The iptree and iptreemap set types are removed: if you refer to them, they are automatically replaced by hash:ip type of sets.