Skip to content

nftables: allow all IP forwarding#50634

Closed
robmry wants to merge 4 commits intomoby:masterfrom
robmry:nftables_no_ip_forward_drop
Closed

nftables: allow all IP forwarding#50634
robmry wants to merge 4 commits intomoby:masterfrom
robmry:nftables_no_ip_forward_drop

Conversation

@robmry
Copy link
Contributor

@robmry robmry commented Aug 5, 2025

- What I did

When Docker is using iptables and it enables IP forwarding, unless daemon option --ip-forward-no-drop is true, it sets the iptables filter-FORWARD policy to DROP.

When running with nftables - don't do that, just turn the host into a router. Docs will need an update to say it's the user's responsibility to update their firewall rules to block unwanted forwarding between non-Docker network interfaces.

Log a warning about that when enabling forwarding.

Log a warning when migrating from iptables to nftables when the iptables policy is DROP, because it'll drop packets that have been accepted by nftables rules (so, for example, published ports won't work).

- How I did it

The first two commits are tidy-up - only nftabler needs an iptables cleaner, and only the iptabler (now) needs a method to set the filter-FORWARD policy. So, use those types directly in the bridge driver when needed.

The third commit drops the policy-setting from nftables and updates tests.

The final commit adds a warning about the iptables policy on migration to nftables.

- How to verify it

Start Docker with IP forwarding disabled and --firewall-backend=iptables - check the filter-FORWARD policies are DROP.
Start Docker again with --firewall-backend=nftables, check logs for a warning about the iptables policy.
Disable IP forwarding, restart with nftables, check for a warning about the firewall rules.

And, updated tests.

- Human readable description for the release notes

- nftables: Docker will enable IP forwarding on the host, but it's the user's responsibility to modify the host's firewall rules to block forwarding between non-Docker interfaces if necessary.

robmry added 2 commits August 5, 2025 10:28
Signed-off-by: Rob Murray <rob.murray@docker.com>
Signed-off-by: Rob Murray <rob.murray@docker.com>
@robmry robmry added this to the 29.0.0 milestone Aug 5, 2025
@robmry robmry self-assigned this Aug 5, 2025
@robmry robmry added kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny impact/changelog docs/revisit area/networking/firewalling Networking area/networking/d/bridge Networking release-blocker PRs we want to block a release on labels Aug 5, 2025
@robmry robmry force-pushed the nftables_no_ip_forward_drop branch from 6564641 to 7c4e0d6 Compare August 5, 2025 14:20
robmry added 2 commits August 5, 2025 15:33
After enabling IP forwarding in the kernel, for nftables only, don't
set the forwarding policy to "drop". It's the user's responsibility
to secure their host when they run Docker with nftables.

Signed-off-by: Rob Murray <rob.murray@docker.com>
Signed-off-by: Rob Murray <rob.murray@docker.com>
@robmry
Copy link
Contributor Author

robmry commented Aug 6, 2025

Next new plan ... #50646

@robmry robmry closed this Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/networking/d/bridge Networking area/networking/firewalling Networking docs/revisit impact/changelog kind/feature Functionality or other elements that the project doesn't currently have. Features are new and shiny release-blocker PRs we want to block a release on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nftables: IP forwarding, and filter-FORWARD policy

1 participant