Docker Community Forums

Share and learn in the Docker community.

Docker disabling kernel network forwarding

Does anyone know why docker disables forwarding for the main network card?

My network card is eno1. Whenever I run docker run or build, the kernel parameter net.ipv4.conf.eno1.forwarding goes from 1 to 0.

I have set

net.ipv4.conf.eno1.forwarding = 1

into /etc/sysctl.conf, but that doesn’t prevent the change.

Found out the problem. The culprit is systemd

Apparently, as of version 226 systemd disables forwarding if it is not explicitly enabled int the configuration. Thus the interface definition must now contain a

IPForward=ipv4

entry in the Network stanza.

Running a container causes systemd to reconfigure the interface according to the config files.