SHOREWALL-TCPRI(5)

πŸ“¦
version 5.2.8 Β· 2 versions
  • 5.2.8 Β· alpine 3.22, alpine 3.23, alpine 3.24, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 5.2.3.4 Β· ubuntu jammy
, in alpine 3.22, alpine 3.23, alpine 3.24, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ SHOREWALL-TCPRI(5) ✨

okay so bestie, you've landed on the shorewall-tcpri page β€” section 5, the Configuration Files corner of the manual. this is the girl that tells your packets who gets to go first. no cap, it's giving traffic-shaping royalty. πŸ‘‘


🌸 NAME 🌸

tcpri β€” the Shorewall file. that's it. that's the name. short, sweet, iconic. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

/etc/shorewall[6]/tcpri

πŸ’– DESCRIPTION πŸ’–

so this file? it's where you specify the priority of traffic for simple traffic shaping. "simple" as in TC_ENABLED=Simple over in shorewall.conf[1](5). yes, it's a whole vibe. πŸŽ€

Starting with Shorewall 5.2.7, this file also allows ?FORMAT 2, which straight up inserts a SPORT column immediately to the right of the DPORT column. glow up fr fr. ✨

here's the tea on how the priority band actually gets picked: the last entry that the packet matches wins. that's it. last one standing, main character energy. and if a packet doesn't match any entry in this file at all? then its priority gets determined by its TOS field. πŸ™ˆ

the default mapping is right here below, but heads up β€” you can change it by setting the TC_PRIOMAP option in shorewall.conf[1](5).

TOS     Bits  Means                    Linux Priority    BAND
------------------------------------------------------------
0x0     0     Normal Service           0 Best Effort     2
0x2     1     Minimize Monetary Cost   1 Filler          3
0x4     2     Maximize Reliability     0 Best Effort     2
0x6     3     mmc+mr                   0 Best Effort     2
0x8     4     Maximize Throughput      2 Bulk            3
0xa     5     mmc+mt                   2 Bulk            3
0xc     6     mr+mt                    2 Bulk            3
0xe     7     mmc+mr+mt                2 Bulk            3
0x10    8     Minimize Delay           6 Interactive     1
0x12    9     mmc+md                   6 Interactive     1
0x14    10    mr+md                    6 Interactive     1
0x16    11    mmc+mr+md                6 Interactive     1
0x18    12    mt+md                    4 Int. Bulk       2
0x1a    13    mmc+mt+md                4 Int. Bulk       2
0x1c    14    mr+mt+md                 4 Int. Bulk       2
0x1e    15    mmc+mr+mt+md             4 Int. Bulk       2

and now, the columns. one by one, bestie, because we don't skip. 🫢

  • BAND β€” {1|2|3} classifies matching traffic as High Priority (1), Medium Priority (2) or Low Priority (3). for those interfaces listed over in shorewall-tcinterfaces[2](5), Priority 2 traffic will be deferred so long as there is Priority 1 traffic queued, and Priority 3 traffic will be deferred so long as there is Priority 1 or Priority 2 traffic to send. yes queen, the queue is a whole social hierarchy. πŸ‘‘
  • PROTO β€” protocol[,...] Optional. the name or number of an IPv4 protocol. Beginning with Shorewall 4.5.12, this column can accept a comma-separated list of protocols. glow up again. ✨
  • DPORT β€” port [,...] this column was named PORT prior to Shorewall 5.2.7. both 'port' and 'dport' may be used in the alternate input format[3]. Optional. may only be given if the PROTO is TCP (6), UDP (17), DCCP (33), SCTP (132) or UDPLITE (136). it's a list of one or more port numbers or service names from /etc/services. port ranges of the form lowport:highport may also be included. in format 1, packets whose source or destination port matches the specified port(s) are assigned to the band given in the BAND column.
  • SPORT β€” port [,...] only present in file format 2! Optional. may only be given if the PROTO is TCP (6), UDP (17), DCCP (33), SCTP (132) or UDPLITE (136). a list of one or more port numbers or service names from /etc/services. port ranges of the form lowport:highport may also be included.
  • ADDRESS β€” [address] Optional. the IP or MAC address that the traffic originated from. MAC addresses must be given in Shorewall format. ⚠️ if this column contains an address, then the PROTO, PORT(S) and INTERFACE column must be empty ("-").
  • INTERFACE β€” [interface] Optional. the logical name of an interface that traffic arrives from. if given, the PROTO, PORT(S) and ADDRESS columns must be empty ("-").
Note πŸ’€ INTERFACE classification of packets happens before classification by PROTO/PORT(S)/ADDRESS. so it is highly recommended to place entries that specify INTERFACE at the top of the file, so that the rule about "last entry matches" is preserved. don't be the girl who breaks her own rule. 😭
  • HELPER β€” [helper] Optional. names a Netfilter protocol helper module such as ftp, sip, amanda, etc. a packet will match if it was accepted by the named helper module. you can also append "-" and a port number to the helper module name (e.g., ftp-21) to specify the port number that the original connection was made on. 🧚

πŸŽ€ FILES πŸŽ€

  • /etc/shorewall/tcpri
  • /etc/shorewall6/tcpri

🌈 SEE ALSO 🌈


πŸ’œ NOTES πŸ’œ

  1. shorewall.conf https://shorewall.org/manpages/shorewall.conf.html
  2. shorewall-tcinterfaces https://shorewall.org/manpages/shorewall-tcinterfaces.html
  3. alternate input format https://shorewall.org/configuration_file_basics.htm#Pairs

and that's the whole page, bestie. πŸ’– this was the Configuration Files girlie, dated 09/24/2020, filed under SHOREWALL-TCPRI(5). go shape some traffic. slay. βœ¨πŸ‘‘πŸ¦‹