SHOREWALL-TUNNELS(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-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):

  • 6to4 or 6in4 β€” 6to4 or 6in4 tunnel. the 6in4 synonym was added in 4.4.24.
  • ipsec β€” IPv4 IPSEC
  • ipsecnat β€” 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 firewall
  • pptpserver β€” PPTP Server runs on the firewall
  • openvpn β€” OpenVPN in point-to-point mode
  • openvpnclient β€” OpenVPN client runs on the firewall
  • openvpnserver β€” OpenVPN server runs on the firewall
  • generic β€” Other tunnel type
  • tinc β€” 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, ?COMMENT is a synonym for COMMENT and 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 ✨

  1. https://shorewall.org/VPNBasics.html https://shorewall.org/VPNBasics.html
  2. shorewall-exclusion https://shorewall.org/manpages/shorewall-exclusion.html
  3. 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 πŸ’–βœ¨πŸ¦‹