SHOREWALL-TCFILTERS(5)
๐ SHOREWALL-TCFILTERS ๐ โ the tcfilters situation
okay bestie, sit down, hydrate, because we're talking about shorewall-tcfilters โ that's the Shorewall u32/basic classifier rules file, straight out of the Configuration Files manual. this is where you tell Shorewall which packets get sorted into which traffic-shaping buckets. it's giving traffic cop energy. ๐ฎโ๏ธโจ
๐ SYNOPSIS ๐
/etc/shorewall[6]/tcfilters
๐ฆ DESCRIPTION ๐ฆ
so like. entries in this file make packets get classified for traffic shaping. that's the whole gig. ๐
starting with Shorewall 4.4.15, this file can hold entries for both IPv4 and IPv6 at the same time. by default every rule applies to IPv4 only, but you can change that by dropping in a line like one of these:
IPV4โ the entries after this apply to IPv4.IPV6โ the entries after this apply to IPv6ALLโ the entries after this apply to both IPv4 and IPv6. each entry gets processed twice: once for IPv4, once for IPv6.
the columns, bestie, in order (and if a column name has a different name in parentheses, that other name is what you use in the alternate specification syntax โ iykyk):
CLASS-interface:classโ the name or number of an interface that's defined inshorewall-tcdevices[1](5), followed by a class number defined for that interface inshorewall-tcclasses[2](5).SOURCE-{-|address|+ipset}โ where the packet came from. can be a host or network address. DNS names are not allowed, sorry babe. starting with Shorewall 4.6.0, you can use an ipset name (prefixed with+) if your kernel and ip6tables have the Basic Ematch capability and you setBASIC_FILTERS=Yesinshorewall.conf (5)[3]. the ipset name can optionally be followed by a number, or a comma separated list ofsrcand/ordstenclosed in square brackets ([...]). seeshorewall-ipsets(5)[4]for the deets.DEST-{-|address|+ipset}โ where the packet is going. can be a host or network address. DNS names are not allowed here either. starting with Shorewall 4.6.0, an ipset name (prefixed with+) works if your kernel and ip6tables have the Basic Ematch capability and you setBASIC_FILTERS=Yesinshorewall.conf (5)[3]. the ipset name may optionally be followed by a number or a comma separated list ofsrcand/ordstin square brackets ([...]). seeshorewall-ipsets(5)[4]for details.
you can also exclude certain hosts from a set that's already defined using an exclusion โ peep shorewall-exclusion[5](5).
PROTO-{-|{protocol-number|protocol-name|all}[,...]}โ the protocol. starting with Shorewall 4.5.12, this column accepts a comma-separated list of protocols. slay.DPORT-[-|port-name-or-number]โ optional destination ports. a port name (fromservices(5)) or a port number. if the protocol isicmp, this column is interpreted as the destination icmp-type(s) instead. ๐
this column used to be labelled DEST PORT(S).
SPORT-[-|port-name-or-number]โ optional source port.
this column used to be labelled SOURCE PORT(S).
TOS(Optional) -[-|tos]โ specifies the value of the TOS field. thetosvalue can be any of these:tos-minimize-delaytos-maximize-throughputtos-maximize-reliabilitytos-minimize-costtos-normal-servicehex-numberhex-number/hex-number
the hex-numbers must be exactly two digits (e.g., 0x04)x.
LENGTH-[-|number]โ optional. must be a power of 2 between 32 and 8192 inclusive. packets whose total length is strictly less than the number you give will match the rule.PRIORITY-[-|priority]โ added in Shorewall 4.5.8. specifies the rule priority. the priority value must be> 0and<= 65535.
when a priority isn't given:
- for Shorewall versions prior to 4.5.8 โ all filters have priority
10. - for Shorewall 4.5.8 and later โ for each device, the compiler keeps a high-water priority with an initial value of
0. when a filter has no priority, the high-water priority gets incremented by 1 and assigned to that filter. when a priority greater than the high-water priority is entered in this column, the high-water priority gets set to that specified priority. and an attempt to assign a priority value greater than65535(explicitly or implicitly) raises an error. ๐จ
the default priority values used by other Shorewall-generated filters are:
- Classify by packet mark โ
( class priority << 8 ) | 20. - Ingress policing โ
10 - Simple TC ACK packets โ
1 - Complex TC ACK packets โ
( class priority << 8 ) | 10. - Classify by TOS โ
( class priority << 8 ) | 15. - Class with
'occurs'โ65535
๐ธ EXAMPLE ๐ธ
IPv4 Example 1: put all 'ping' traffic on interface 1 into class 10. note that ALL cannot be used here because IPv4 ICMP and IPv6 ICMP are two different protocols.
#CLASS SOURCE DEST PROTO DPORT
IPV4
1:10 0.0.0.0/0 0.0.0.0/0 icmp echo-request
1:10 0.0.0.0/0 0.0.0.0/0 icmp echo-reply
IPV6
1:10 ::/0 ::/0 icmp6 echo-request
1:10 ::/0 ::/0 icmp6 echo-reply
IPv4 Example 2: add two filters with priority 10 (Shorewall 4.5.8 or later).
#CLASS SOURCE DEST PROTO DPORT PRIORITY
IPV4
1:10 0.0.0.0/0 0.0.0.0/0 icmp echo-request 10
1:10 0.0.0.0/0 0.0.0.0/0 icmp echo-reply 10
IPv6 Example 1: add two filters with priority 10 (Shorewall 4.5.8 or later).
#CLASS SOURCE DEST PROTO DPORT PRIORITY
IPV6
1:10 ::/0 ::/0 icmp echo-request 10
1:10 ::/0 ::/0 icmp echo-reply 10
๐ FILES ๐
/etc/shorewall/tcfilters/etc/shorewall6/tcfilters
๐ SEE ALSO ๐
https://shorewall.org/traffic_shaping.htm[6]https://shorewall.org/MultiISP.html[7]https://shorewall.org/PacketMarking.html[8]https://shorewall.org/configuration_file_basics.htm#Pairs[9]shorewall(8)
โจ NOTES โจ
shorewall-tcdeviceshttps://shorewall.org/manpages/shorewall-tcdevices.htmlshorewall-tcclasseshttps://shorewall.org/manpages/shorewall-tcclasses.htmlshorewall.conf (5)https://shorewall.org/manpages/shorewall.conf.htmlshorewall-ipsets(5)https://shorewall.org/manpages/shorewall-ipsets.htmlshorewall-exclusionhttps://shorewall.org/manpages/shorewall-exclusion.htmlhttps://shorewall.org/traffic_shaping.htmhttps://shorewall.org/traffic_shaping.htmhttps://shorewall.org/MultiISP.htmlhttps://shorewall.org/MultiISP.htmlhttps://shorewall.org/PacketMarking.htmlhttps://shorewall.org/PacketMarking.htmlhttps://shorewall.org/configuration_file_basics.htm#Pairshttps://shorewall.org/configuration_file_basics.htm#Pairs
and that's the whole page, bestie ๐
this came out of the Configuration Files manual, dated 09/24/2020, and it's filed under SHOREWALL-TCFILTERS(5). go forth and classify. periodt. ๐ฆ
๐ฆ 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