networkd: add minimal IP forwarding and masquerading support to .network files

This adds two new settings to networkd's .network files:
IPForwarding=yes and IPMasquerade=yes. The former controls the
"forwarding" sysctl setting of the interface, thus controlling whether
IP forwarding shall be enabled on the specific interface. The latter
controls whether a firewall rule shall be installed that exposes traffic
coming from the interface as coming from the local host to all other
interfaces.

This also enables both options by default for container network
interfaces, thus making "systemd-nspawn --network-veth" have network
connectivity out of the box.
This commit is contained in:
Lennart Poettering
2015-01-13 13:55:15 +01:00
parent 76917807eb
commit 5a8bcb674f
10 changed files with 232 additions and 70 deletions
+24
View File
@@ -344,6 +344,30 @@
<para>An NTP server address. This option may be specified more than once.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>IPForward=</varname></term>
<listitem><para>Configures IP
forwarding for the network
interface. If enabled incoming
packets on the network
interface will be forwarded to
other interfaces according to
the routing table. Takes a
boolean
argument.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>IPMasquerade=</varname></term>
<listitem><para>Configures IP
masquerading for the network
interface. If enabled packets
forwarded from the network
interface will be appear as
coming from the local
host. Takes a boolean
argument. Implies
<varname>IPForward=yes</varname>.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>Bridge=</varname></term>
<listitem>