Docker Vpn Passthrough

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover, and with no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.

Table of Contents

Virtual Private Networking (VPN)

It is often the case that a system behind the firewall needs to be able to access a remote network through Virtual Private Networking (VPN). The two most common means for doing this are IPsec and PPTP. The basic setup is shown in the following diagram:

A system with an RFC 1918 address needs to access a remote network through a remote gateway. For this example, we will assume that the local system has IP address 192.168.1.12 and that the remote gateway has IP address 192.0.2.224.

If PPTP is being used and you need to have two or more local systems connected to the same remote server at the same time, then you should be sure that the PPTP helpers modules are loaded (ip_conntrack_pptp and ip_nat_pptp or nf_conntrack_pptp and nf_nat_pptp). Using the default modules file, Shorewall (Lite) will attempt to load these modules when Shorewall (Lite) is started.

If IPsec is being used, you should configure IPsec to use NAT Traversal -- Under NAT traversal the IPsec packets (protocol 50 or 51) are encapsulated in UDP packets (normally with destination port 4500). Additionally, keep-alive messages are sent frequently so that NATing gateways between the end-points will retain their connection-tracking entries. This is the way that I connect to the HP Intranet and it works flawlessly without anything in Shorewall other than my ACCEPT loc->net policy. NAT traversal is available as a patch for Windows 2K and is a standard feature of Windows XP -- simply select 'L2TP IPsec VPN' from the 'Type of VPN' pulldown.

Alternatively, if you have an IPsec gateway behind your firewall then you can try the following: only one system may connect to the remote gateway and there are firewall configuration requirements as follows:

Docker For Mac Vpn Passthrough

Table 1. /etc/shorewall/rules

ACTIONSOURCEDESTPROTODPORTSPORTORIGDEST
DNATnet:192.0.2.224loc:192.168.1.1250
DNATnet:192.0.2.224loc:192.168.1.12udp500

The above may or may not work — your mileage may vary. NAT Traversal is definitely a better solution. To use NAT traversal:

The basic setup is shown in the following diagram: A system with an RFC 1918 address needs to access a remote network through a remote gateway. For this example, we will assume that the local system has IP address 192.168.1.12 and that the remote gateway has IP address 192.0.2.224. If PPTP is being used and you need to have two or more local. VPN Passthrough 🔗 Docker Desktop for Mac’s networking can work when attached to a VPN. To do this, Docker Desktop for Mac intercepts traffic from the containers and injects it into Mac as if it originated from the Docker application.

Docker windows vpn passthrough

Table 2. /etc/shorewall/rules with NAT Traversal

ACTIONSOURCEDESTPROTODPORTSPORTORIGDEST
DNATnet:192.0.2.224loc:192.168.1.12udp4500
DNATnet:192.0.2.224loc:192.168.1.12udp500


If you want to be able to give access to all of your local systems to the remote network, you should consider running a VPN client on your firewall. As starting points, see The /etc/shorewall/tunnels manpage.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover, and with no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.

Table of Contents

Shorewall 5.0.5 and Earlier
Shorewall 5.0.6 and Later

Both Docker and Shorewall assume that they 'own' the iptables configuration. This leads to problems when Shorewall is restarted or reloaded, because it drops all of the rules added by Docker. Fortunately, the extensibility features in Shorewall allow users to create their own solution for saving the Docker-generated rules before these operations and restoring them afterwards.

Beginning with Shorewall 5.0.6, Shorewall has native support for simple Docker configurations. This support is enabled by setting DOCKER=Yes in shorewall.conf. With this setting, the generated script saves the Docker-created ruleset before executing a stop, start, restart or reload operation and restores those rules along with the Shorewall-generated ruleset.

Docker Desktop Vpn Passthrough

Important

Shorewall currently doesn't support Docker Swarm mode.

Warning

On Debian and Debian-derived systems, systemctl restart shorewall will lose Docker rules. You can work around this issue using a method provided by J Cliff Armstrong:

Type as root:

This will open the default terminal editor to a blank file in which you can paste the following:

Then type systemctl daemon-reload to activate the changes. This change will survive future updates of the shorewall package from apt repositories. The override file itself will be saved to `/etc/systemd/system/shorewall.service.d/`.

This support assumes that the default Docker bridge (docker0) is being used. It is recommended that this bridge be defined to Shorewall in shorewall-interfaces(8). As shown below, you can control inter-container communication using the bridge and routeback options. If docker0 is not defined to Shorewall, then Shorewall will save and restore the FORWARD chain rules involving that interface.

/etc/shorewall/shorewall.conf:

Docker Windows Vpn Passthrough

/etc/shorewall/zones:

/etc/shorewall/policy:

Docker Desktop Windows Vpn Passthrough

/etc/shorewall/interfaces:

or