[systemd-devel] Recommended way to enable IPForward for a system using networkd?

Filipe Brandenburger filbranden at google.com
Thu Aug 2 17:28:47 UTC 2018


On Thu, Aug 2, 2018 at 10:21 AM Mantas Mikulėnas <grawity at gmail.com> wrote:

> On Thu, Aug 2, 2018 at 8:18 PM Filipe Brandenburger <filbranden at google.com>
> wrote:
>
>> So, IPForward is a global setting and yet with networkd it needs to be
>> attached to an interface...
>>
>> What's the best way to enable it on a system, that's general enough and
>> won't really depend on the existing interface configurations (let's assume
>> those will be managed separately through drop-ins somehow...)
>>
>
> It's a sysctl, so just set it through /etc/sysctl.d:
>

Yes, I guess that would work... But I think this breaks into the
abstraction a bit... Should I really care how forwarding is *implemented*?


> net.ipv4.conf.all.forwarding = 1
> net.ipv6.conf.all.forwarding = 1
>

Actually, for IPv4 networkd sets net.ipv4.ip_forwarding = 1.
https://github.com/systemd/systemd/blob/v239/src/network/networkd-link.c#L2455


> (For IPv4 it is both a global *and* per-interface setting, for some
> reason.)
>

Yes, and looking at the history of the IPForward= feature, it used to be
per-interface, but caused confusing behavior, so at some point it was
decided to make it always work at a global scope, even though it's still
configured per interface.

So: would it make sense to consider making it possible to configure this
from the systemd-wide networkd.conf?

Or: am I missing a way to have a *.network file that would apply to all
interfaces, even the ones that were previously configured?

Cheers,
Filipe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180802/9919e5c2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4851 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180802/9919e5c2/attachment-0001.bin>


More information about the systemd-devel mailing list