Skip to content

Commit 6c3e9e3

Browse files
committed
Update notes about IP Forwarding and the default DROP policy
Signed-off-by: Rob Murray <[email protected]>
1 parent 4c517e9 commit 6c3e9e3

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

content/manuals/engine/network/packet-filtering-firewalls.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,35 @@ Alternatively, you can use the `dockerd --ip` flag when starting the daemon.
308308

309309
## Docker on a router
310310

311-
Docker sets the policy for the `FORWARD` chain to `DROP`. This will prevent
312-
your Docker host from acting as a router.
311+
On Linux, Docker needs "IP Forwarding" enabled on the host. So, it enables
312+
the `sysctl` settings `net.ipv4.ip_forward` and `net.ipv6.conf.all.forwarding`
313+
it they are not already enabled when it starts.
313314

314-
If you want your system to function as a router, you must add explicit
315-
`ACCEPT` rules to the `DOCKER-USER` chain. For example:
315+
If Docker sets the policy for the `FORWARD` chain to `DROP`. This will prevent
316+
your Docker host from acting as a router, it is the recommended setting when
317+
IP Forwarding is enabled.
318+
319+
To stop Docker from setting the `FORWARD` chain's policy to `DROP`, include
320+
`"ip-forward-no-drop": true` in `/etc/docker/daemon.json`, or add option
321+
`--ip-forward-no-drop` to the `dockerd` command line.
322+
323+
Alternatively, you may add `ACCEPT` rules to the `DOCKER-USER` chain for the
324+
packets you want to forward. For example:
316325

317326
```console
318327
$ iptables -I DOCKER-USER -i src_if -o dst_if -j ACCEPT
319328
```
320329

330+
> [!WARNING]
331+
>
332+
> In releases older than 28.0.0, Docker always set the default policy of the
333+
> `FORWARD` chain to `DROP`. In release 28.0.0 and newer, it will only set
334+
> that policy if it enables IPv6 forwarding itself. This has always been the
335+
> behaviour for IPv4 forwarding.
336+
>
337+
> If IPv6 forwarding is enabled on your host before Docker starts, check your
338+
> host's configuration to make sure it is still secure.
339+
321340
## Prevent Docker from manipulating iptables
322341

323342
It is possible to set the `iptables` or `ip6tables` keys to `false` in

0 commit comments

Comments
 (0)