SHOREWALL-RTRULES(5)
π rtrules β the Shorewall Routing Rules file π
okay bestie, welcome to rtrules, aka section 5 of the manual, aka Configuration Files. this is the glow-up guide to telling Shorewall where your traffic should, like, actually go. π¦
β¨ SYNOPSIS β¨
/etc/shorewall[6]/rtrules
πΈ DESCRIPTION πΈ
so here's the tea: entries in this file make your traffic get routed to one of the providers listed in shorewall-providers[1](5). that's it. that's the whole job. π
the columns in the file are as follows, bestie β one at a time, no skipping:
π SOURCE (Optional) β {-|[&]interface|address|interface:address}
an ip address (network or host) that matches the source IP address in a packet. you can also write it as an interface name, optionally followed by ":" and an address. and if you specify the device lo, then the packet has to originate from the firewall itself. very main character of it.
beginning with Shorewall 4.5.0, you may specify &interface in this column to say that the source is the primary IP address of the named interface.
beginning with Shorewall 4.6.8, you may specify a comma-separated list of addresses in this column. π
π DEST (Optional) β {-|address}
an ip address (network or host) that matches the destination IP address in a packet.
if you choose to omit either SOURCE or DEST, place - in that column. note that you may not omit both SOURCE and DEST. nope. not allowed. periodt.
beginning with Shorewall 4.6.8, you may specify a comma-separated list of addresses in this column too. β¨
π PROVIDER β {provider-name|provider-number|main}
the provider to route the traffic through. may be expressed either as the provider name or the provider number. may also be main or 254 for the main routing table. this can be used in combination with VPN tunnels, see example 2 below. iykyk.
π₯ PRIORITY β priority[!]
the rule's numeric priority which determines the order in which the rules are processed. rules with equal priority are applied in the order in which they appear in the file.
1000-1999β before Shorewall-generated 'MARK' rules11000-11999β after 'MARK' rules but before Shorewall-generated rules for ISP interfaces.26000-26999β after ISP interface rules but before 'default' rule.
beginning with Shorewall 5.0.2, the priority may be followed optionally by an exclamation mark ("!"). this causes the rule to remain in place if the interface is disabled. π«Ά
Caution π be careful when using rules of the same PRIORITY as some unexpected behavior can occur when multiple rules have the same SOURCE. for example, in the following rules, the second rule overwrites the first unless the priority in the second is changed to 19001 or higher:
10.10.0.0/24 192.168.5.6 provider1 19000
10.10.0.0/24 - provider2 19000
π§ MARK β {-|mark[/mask]}
optional β added in Shorewall 4.4.25. for this rule to be applied to a packet, the packet's mark value must match the mark when logically anded with the mask. if a mask is not supplied, Shorewall supplies a suitable provider mask. slay.
β EXAMPLES β
Example 1: π
you want all traffic coming in on eth1 to be routed to the ISP1 provider.
#SOURCE DEST PROVIDER PRIORITY MASK
eth1 - ISP1 1000
IPv4 Example 2: π
you use OpenVPN (routed setup /tunX) in combination with multiple providers. in this case you have to set up a rule to ensure that the OpenVPN traffic is routed back through the tunX interface(s) rather than through any of the providers. 10.8.0.0/24 is the subnet chosen in your OpenVPN configuration (server 10.8.0.0 255.255.255.0).
#SOURCE DEST PROVIDER PRIORITY MASK
- 10.8.0.0/24 main 1000
π FILES π
/etc/shorewall/rtrules/etc/shorewall6/rtrules
π SEE ALSO π
https://shorewall.org/MultiISP.html[2]https://shorewall.org/configuration_file_basics.htm#Pairs[3]shorewall(8)
π¦ NOTES π¦
shorewall-providershttps://shorewall.org/manpages/shorewall-providers.htmlhttps://shorewall.org/MultiISP.htmlhttps://shorewall.org/MultiISP.htmlhttps://shorewall.org/configuration_file_basics.htm#Pairshttps://shorewall.org/configuration_file_basics.htm#Pairs
and that's the whole page, bestie!! Configuration Files, dated 09/24/2020, from the SHOREWALL-RTRULES(5) era β go route 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