SHOREWALL-TUNNELS(5)
π SHOREWALL-TUNNELS π
okay bestie, listen β this is the manual page for shorewall-tunnels, section 5 of the Configuration Files manual. it's all about the file where you tell Shorewall about your VPN tunnels. let's get into it π«Ά
β¨ NAME β¨
tunnels β the Shorewall VPN definition file. that's it, that's the name π
β¨ SYNOPSIS β¨
/etc/shorewall[6]/tunnels
β¨ DESCRIPTION β¨
so the tunnels file is where you define rules so that encapsulated traffic (usually encrypted, bestie, we love a little encryption moment π) can pass between the Shorewall system and a remote gateway. once traffic is flowing through the tunnel, it gets handled by the normal zone/policy/rule mechanism like everything else. for the full tea, go read https://shorewall.org/VPNBasics.html.
the columns in the file are as follows, no cap:
TYPE β no seriously it's the TYPE column π
{ipsec[:{noah|ah}]|ipsecnat|ipip|gre|l2tp|pptpclient|pptpserver|?COMMENT|{openvpn|openvpnclient|openvpnserver}[:{tcp|udp}][:port]|generic:protocol[:port]}
the types are as follows (this is the whole list, i'm not skipping a single one):
6to4or6in4β 6to4 or 6in4 tunnel. the6in4synonym was added in 4.4.24.ipsecβ IPv4 IPSECipsecnatβ IPv4 IPSEC with NAT Traversal (UDP port 4500 encapsulation)ipipβ IPv4 encapsulated in IPv4 (Protocol 4)greβ Generalized Routing Encapsulation (Protocol 47)l2tpβ Layer 2 Tunneling Protocol (UDP port 1701)pptpclientβ PPTP Client runs on the firewallpptpserverβ PPTP Server runs on the firewallopenvpnβ OpenVPN in point-to-point modeopenvpnclientβ OpenVPN client runs on the firewallopenvpnserverβ OpenVPN server runs on the firewallgenericβ Other tunnel typetincβ TINC (added in Shorewall 4.6.6)
if the type is ipsec, it may be followed by :ah to say that the Authentication Headers protocol (51) is used by the tunnel. the default is :noah, which means protocol 51 is not used. important lore: NAT traversal is only supported with ESP (protocol 50), so ipsecnat tunnels don't allow the ah option. you may specify ipsecnat:noah but it's redundant, like bringing a snack to a snack party π
if the type is openvpn, openvpnclient or openvpnserver, it may optionally be followed by ":" and tcp or udp to specify the protocol to be used. if you don't specify, udp is assumed, periodt.
if the type is openvpn, openvpnclient or openvpnserver, it may optionally be followed by ":" and the port number used by the tunnel. if no ":" and port number are included, then the default port of 1194 is used. where both the protocol and port are specified, the protocol must be given first (e.g., openvpn:tcp:4444). order matters, bestie, it's giving strict π
if the type is generic, it must be followed by ":" and a protocol name (from /etc/protocols) or a protocol number. if the protocol is tcp or udp (6 or 17), then it may optionally be followed by ":" and a port number.
comments may be attached to Netfilter rules generated from entries in this file through the use of /COMMENT lines. these lines begin with ?COMMENT; the remainder of the line is treated as a comment which is attached to subsequent rules until another ?COMMENT line is found or until the end of the file is reached. to stop adding comments to rules, use a line containing only ?COMMENT. iconic behaviour honestly β¨
Note π Beginning with Shorewall 4.5.11,?COMMENTis a synonym forCOMMENTand is preferred.
ZONE β zone π¦
the zone of the physical interface through which tunnel traffic passes. this is normally your internet zone, iykyk.
GATEWAY(S) (gateway or gateways) β address-or-range [ , ... ] πΈ
the IP address of the remote tunnel gateway. if the remote gateway has no fixed address (Road Warrior, main character energy, connecting from anywhere π«) then specify the gateway as 0.0.0.0/0. may be specified as a network address, and if your kernel and iptables include iprange match support then IP address ranges are also allowed.
beginning with Shorewall 4.5.3, a list of addresses or ranges may be given. exclusion (shorewall-exclusion(5)) is not supported. sorry bestie, no exclusion here π
GATEWAY ZONES (gateway_zone or gateway_zones) β [zone[,zone]...] π
optional. if the gateway system specified in the third column is a standalone host then this column should contain a comma-separated list of the names of the zones that the host might be in. this column only applies to IPSEC tunnels where it enables ISAKMP traffic to flow through the tunnel to the remote gateway(s). so niche, so useful π
β¨ EXAMPLE β¨
IPv4 Example 1: π₯
IPSec tunnel.
the remote gateway is 4.33.99.124 and the remote subnet is 192.168.9.0/24. the tunnel does not use the AH protocol
#TYPE ZONE GATEWAY
ipsec:noah net 4.33.99.124
IPv4 Example 2:
Road Warrior (LapTop that may connect from anywhere) where the "gw" zone is used to represent the remote LapTop
#TYPE ZONE GATEWAY GATEWAY ZONES
ipsec net 0.0.0.0/0 gw
IPv4 Example 3:
Host 4.33.99.124 is a standalone system connected via an ipsec tunnel to the firewall system. the host is in zone gw.
#TYPE ZONE GATEWAY GATEWAY ZONES
ipsec net 4.33.99.124 gw
IPv4 Example 4:
Road Warriors that may belong to zones vpn1, vpn2 or vpn3. the FreeS/Wan _updown script will add the host to the appropriate zone using the shorewall add command on connect and will remove the host from the zone at disconnect time.
#TYPE ZONE GATEWAY GATEWAY ZONES
ipsec net 0.0.0.0/0 vpn1,vpn2,vpn3
IPv4 Example 5:
You run the Linux PPTP client on your firewall and connect to server 192.0.2.221.
#TYPE ZONE GATEWAY GATEWAY ZONES
pptpclient net 192.0.2.221
IPv4 Example 6:
You run a PPTP server on your firewall.
#TYPE ZONE GATEWAY GATEWAY ZONES
pptpserver net 0.0.0.0/0
Example 7:
OPENVPN tunnel. the remote gateway is 4.33.99.124 and openvpn uses port 7777.
#TYPE ZONE GATEWAY GATEWAY ZONES
openvpn:7777 net 4.33.99.124
IPv4 Example 8:
You have a tunnel that is not one of the supported types. your tunnel uses UDP port 4444. the other end of the tunnel is 4.3.99.124.
#TYPE ZONE GATEWAY GATEWAY ZONES
generic:udp:4444 net 4.3.99.124
IPv4 Example 9:
TINC tunnel where the remote gateways are not specified. if you wish to specify a list of gateways, you can do so in the GATEWAY column.
#TYPE ZONE GATEWAY GATEWAY ZONES
tinc net 0.0.0.0/0
IPv6 Example 1:
IPSec tunnel.
the remote gateway is 2001:cec792b4:1::44. the tunnel does not use the AH protocol
#TYPE ZONE GATEWAY
ipsec:noah net 2002:cec792b4:1::44
IPv6 Example 2:
Road Warrior (LapTop that may connect from anywhere) where the "gw" zone is used to represent the remote LapTop
#TYPE ZONE GATEWAY GATEWAY ZONES
ipsec net ::/0 gw
IPv6 Example 3:
Host 2001:cec792b4:1::44 is a standalone system connected via an ipsec tunnel to the firewall system. the host is in zone gw.
#TYPE ZONE GATEWAY GATEWAY ZONES
ipsec net 2001:cec792b4:1::44 gw
IPv6 Example 4:
OPENVPN tunnel. the remote gateway is 2001:cec792b4:1::44 and openvpn uses port 7777.
#TYPE ZONE GATEWAY GATEWAY ZONES
openvpn:7777 net 2001:cec792b4:1::44
IPv6 Example 8:
You have a tunnel that is not one of the supported types. your tunnel uses UDP port 4444. the other end of the tunnel is 2001:cec792b4:1::44.
#TYPE ZONE GATEWAY GATEWAY ZONES
generic:udp:4444 net 2001:cec792b4:1::44
IPv6 Example 9:
TINC tunnel where the remote gateways are not specified. if you wish to specify a list of gateways, you can do so in the GATEWAY column.
#TYPE ZONE GATEWAY GATEWAY ZONES
tinc net ::/0
β¨ FILES β¨
/etc/shorewall/tunnels/etc/shorewall6/tunnels
β¨ SEE ALSO β¨
β¨ NOTES β¨
- https://shorewall.org/VPNBasics.html https://shorewall.org/VPNBasics.html
shorewall-exclusionhttps://shorewall.org/manpages/shorewall-exclusion.html- https://shorewall.org/configuration_file_basics.htm#Pairs https://shorewall.org/configuration_file_basics.htm#Pairs
and that's the whole page, bestie!! π this one lives in the Configuration Files manual, dated 09/24/2020, and yeah β it's literally titled SHOREWALL-TUNNELS(5). go configure your tunnels, you've got this πβ¨π¦
π¦ where this page comes from
- alpine 3.22: shorewall-doc 5.2.8-r1 Β· GPL-2.0-or-later
- alpine 3.23: shorewall-doc 5.2.8-r1 Β· GPL-2.0-or-later
- alpine 3.24: shorewall-doc 5.2.8-r1 Β· GPL-2.0-or-later
- debian bookworm: shorewall 5.2.8-2 Β· GPL-2.0-or-later
- debian trixie: shorewall 5.2.8-6 Β· GPL-2.0-or-later
- fedora 43: shorewall 5.2.8-17.fc43 Β· GPL-2.0-or-later
- fedora 44: shorewall 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: shorewall 5.2.8-5 Β· GPL-2.0-or-later
- ubuntu questing: shorewall 5.2.8-6
- ubuntu resolute: shorewall 5.2.8-6build1 Β· GPL-2.0-or-later
- ubuntu stonking: shorewall 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