From 285ad6c8de6cade523b5e75791a8b41706fc8e84 Mon Sep 17 00:00:00 2001 From: Albert Hopkins Date: Sun, 4 Dec 2016 22:45:40 +0000 Subject: [PATCH] docker: fix ip forwarding in containers when the host is running systemd Finally this is fixed. Thanks Arch Linux wiki. --- appliances/docker/30-ipforward.conf | 3 +++ appliances/docker/Makefile | 4 +++- appliances/docker/eth.network | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 appliances/docker/30-ipforward.conf create mode 100644 appliances/docker/eth.network diff --git a/appliances/docker/30-ipforward.conf b/appliances/docker/30-ipforward.conf new file mode 100644 index 0000000..b6f093b --- /dev/null +++ b/appliances/docker/30-ipforward.conf @@ -0,0 +1,3 @@ +net.ipv4.ip_forward=1 +net.ipv6.conf.default.forwarding=1 +net.ipv6.conf.all.forwarding=1 diff --git a/appliances/docker/Makefile b/appliances/docker/Makefile index c49ad00..f03c9d1 100644 --- a/appliances/docker/Makefile +++ b/appliances/docker/Makefile @@ -1,6 +1,8 @@ preinstall: -postinstall: +postinstall: 30-ipforward.conf eth.network + cp 30-ipforward.conf $(CHROOT)/etc/sysctl.d/ + cp eth.network $(CHROOT)/etc/systemd/network/ $(inroot) systemctl enable docker.service clean: diff --git a/appliances/docker/eth.network b/appliances/docker/eth.network new file mode 100644 index 0000000..8bd9bd3 --- /dev/null +++ b/appliances/docker/eth.network @@ -0,0 +1,5 @@ +[Match] + +[Network] +DHCP=both +IPForward=kernel