SHOREWALL-IPSETS(5)
β¨ SHOREWALL-IPSETS β¨
okay bestie, welcome to the SHOREWALL-IPSETS(5) page β it lives in the Configuration Files section of the manual, and it's all about how you name an ipset inside Shorewall's config files. pull up a chair, this one's actually fun π
πΈ NAME πΈ
ipsets β how you spell out the name of an ipset in Shorewall configuration files. literally that's it, that's the job π«Ά
π SYNOPSIS π
+ipsetname
+ipsetname[flag,...]
+[ipsetname,...]
π DESCRIPTION π
heads up, bestie: in all those syntax lines up there, the square brackets ([]) are meant literally, not as meta-characters. yes really. they're part of the vibe, not a placeholder. π
so, in most places where you could type a network address, you can slide an ipset in instead. the rules for set names are:
- they must be prefixed with the character
+ - they must start with a letter
- they may be made up of alphanumeric characters,
-and_
Whether the set gets matched against the packet source or the destination is decided by which column the set name shows up in β SOURCE or DEST. (the column decides, not you. the column is the main character here π)
For those set types that specify a tuple, you've got two alternative syntaxes to pick from:
[number]β this says thatsrcordstshould be repeated number times. Example:myset[2].[flag,...]β where flag issrcordst. Example:myset[src,dst].
In a SOURCE or SPORT column, these two are the same thing:
+myset[2]and+myset[src,src]
In a DEST or DPORT column, these two are the same thing:
+myset[2]and+myset[dst,dst]
π¦ multiple matches (Shorewall 4.4.14+) π¦
Starting with Shorewall 4.4.14, you can specify multiple source or destination matches by wrapping the set names inside +[...]. cute, right? and plot twist: the set names in there don't need the + prefix. when you give a list of sets like that, a matching packet has to match all of the listed sets. all of them. no skipping. π
want the tea on set lists and exclusion? go see shorewall-exclusion[1] (5).
π nfacct counters (Shorewall 4.5.16+) π
Starting with Shorewall 4.5.16, you can increment one or more nfacct objects every single time a packet matches an ipset. how? list the objects separated by commas, inside parentheses. obsessed.
Example:
+myset[src](myobject)
In that example, when the source address of a packet matches the myset ipset, the myobject nfacct counter gets incremented. slay β¨
π match options (Shorewall 4.6.0+) π
Starting with Shorewall 4.6.0, an ipset name (and the src/dst list, if there is one) can be immediately followed by a list of match options.
Important: these extra match options are not available in shorewall-tcfilters(5)[2]. nope. not there. don't try it π
Available options are:
nomatchβ if the set type supports thenomatchflag, then the matching gets reversed: a match with an element flagged withnomatchreturns true, while a match with a plain element returns false. this one requires the'Ipset Match nomatch'capability in your kernel andip[6]tables.no-update-countersβ the packet and byte counters of the matching element in the set won't be updated. by default, the packet and byte counters are updated. this option and the ones that follow require the'Ipset Match counters'capability in your kernel andip[6]tables.no-update-subcountersβ the packet and byte counters of the matching element in the member set of a list type of set won't be updated. default: the packet and byte counters are updated.packets=valueβ if the packet matches an element in the set, match only if the packet counter of the element matches the given value too.packets<valueβ if the packet matches an element in the set, match only if the packet counter of the element is less than the given value as well.packets>valueβ if the packet matches an element in the set, match only if the packet counter of the element is greater than the given value as well.packets!=valueβ if the packet matches an element in the set, match only if the packet counter of the element does not match the given value too.bytes=valueβ if the packet matches an element in the set, match only if the byte counter of the element matches the given value too.bytes<valueβ if the packet matches an element in the set, match only if the byte counter of the element is less than the given value as well.bytes>valueβ if the packet matches an element in the set, match only if the byte counter of the element is greater than the given value as well.bytes<>valueβ if the packet matches an element in the set, match only if the byte counter of the element does not match the given value too.
π₯ EXAMPLES π₯
in all the examples below, myset, myset1 and myset2 are ipsets, and myObject is an NFacct object name. iykyk π
+myset
+myset[src]
+myset[2]
+[myset1,myset2[dst]]
+myset[src](myObject)
+myset[src,nomatch,packets>100]
+myset[nomatch,no-update-counters](myObject)
π FILES π
/etc/shorewall/accounting/etc/shorewall6/accounting/etc/shorewall/blrules/etc/shorewall6/blrules/etc/shorewall/hostsβ Note: multiple matches enclosed in+[...]may not be used in this file./etc/shorewall6/hostsβ Note: multiple matches enclosed in+[...]may not be used in this file./etc/shorewall/maclistβ Note: multiple matches enclosed in+[...]may not be used in this file./etc/shorewall6/maclistβ Note: multiple matches enclosed in+[...]may not be used in this file./etc/shorewall/rules/etc/shorewall6/rules/etc/shorewall/secmarks/etc/shorewall6/secmarks/etc/shorewall/mangle/etc/shorewall6/mangle/etc/shorewall/snat/etc/shorewall6/snat
π SEE ALSO π
π NOTES π
shorewall-exclusionhttps://shorewall.org/manpages/shorewall-exclusion.htmlshorewall-tcfilters(5)https://shorewall.org/manpages/shorewall-tcfilters.html
okay that's the whole page, bestie, you ate it π«Ά this one came out of the Configuration Files section of the manual, dated 09/24/2020, and it goes by SHOREWALL-IPSETS(5). go configure something iconic πβ¨
π¦ where this page comes from
- alpine 3.22: shorewall6-doc 5.2.8-r1 Β· GPL-2.0-or-later
- alpine 3.23: shorewall6-doc 5.2.8-r1 Β· GPL-2.0-or-later
- alpine 3.24: shorewall6-doc 5.2.8-r1 Β· GPL-2.0-or-later
- debian bookworm: shorewall6 5.2.8-2 Β· GPL-2.0-or-later
- debian trixie: shorewall6 5.2.8-6 Β· GPL-2.0-or-later
- fedora 43: shorewall6 5.2.8-17.fc43 Β· GPL-2.0-or-later
- fedora 44: shorewall6 5.2.8-18.fc44 Β· GPL-2.0-or-later
- nixos 26.05: shorewall 5.2.8
- nixpkgs unstable: shorewall 5.2.8
- ubuntu noble: shorewall6 5.2.8-5 Β· GPL-2.0-or-later
- ubuntu questing: shorewall6 5.2.8-6
- ubuntu resolute: shorewall6 5.2.8-6build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms