-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native support for nftables #1472
Comments
Migrate Docker to iptables-legacy: If nftables is causing conflicts with Docker's iptables rules, you can consider changing the default iptables backend from iptables-nft to iptables-legacy. This can be done by updating the alternatives configuration. However, keep in mind that this may not be a long-term solution, as support for iptables-legacy might eventually be phased out in favor of nftables. update-alternatives --set iptables /usr/sbin/iptables-legacy Use Docker Compose: If you're using Docker Compose to manage your containers, you can define custom network rules in your Compose file using the network_mode option. This allows you to manage network rules separately from Docker. Here's an example of how you can define a custom network in your docker-compose.yml |
I don't have problems with nftables, but with docker's iptables implementation. As from my understanding it is still using iptables right, as it creates iptables rules? I don't want to migrate to legacy iptables-legacy backend. If docker is already using nftables, why do my nftables the overwrite docker's iptables rules, when reloading? |
If your nftables.conf contains |
Is this really a problem with Docker? As @jeromecst mentioned, if the primary nftables.conf contains One solution would be for Docker to write it's rules to a dedicated file and include this file from the primary nftables.conf. |
No. |
Actually docker does not use nftables natively, from debian 10 onwards nftables is the default framework, debian installs the iptables-nft package which translates iptables rules to nft rules. |
Without Do you have this working? Wondering because the I believe the point of this issue is that sooner or later iptables wrappers will be deprecated and nftables is the only way forward. |
I didn’t try any longer. I think docker should natively understand nftables rulesets, but still iptables. Otherwise in my opinion it’s useless if you have an existing nftables ruleset and want to load the rules from docker into it.Or did I completely misunderstand the concept?Sent from my iPhoneOn 3. Apr 2024, at 13:26, bluikko ***@***.***> wrote:
If docker is already using nftables, why do my nftables the overwrite docker's iptables rules, when reloading?
If your nftables.conf contains flush ruleset, it will flush all previous rules (including docker's) when reloading
Without flush ruleset all the rules will be duplicated since the new ruleset will just be added to the already existing chain.
I guess that could be worked around with just flush table / flush chain instead.
Do you have this working? Wondering because the iptables tools stop working after modifications with nft on EL9 -- is Docker still able to change its rules after direct modifications to nftables?
I believe the point of this issue is that sooner or later iptables wrappers will be deprecated and nftables is the only way forward.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I agree with the author it's a mess to work like that on distro that use nftables as main way to manage firewall. |
nftables support is being worked on, however it is not a small change and cuts through just about every bit of the network stack. |
In the meantime, https://git.netfilter.org/nftables/commit/?id=e1dfd5cc4c46514a84dd8a2063b45517b596e1ca |
Just want to throw some comments in here. These are based on RHEL9 or compatible systems with a very simple network setup (single main interface Installing The main problem is that
In my testing, if these two things are fixed, Docker would work with Since this isn't supported currently, instead what we've had to do is create an
The downside of this approach is |
Is there an ETA for a release that supports nftables? |
Its not like we havent known nftables is replacing iptables for a long long time! Still its nice to know thanks. |
iptables and the iptables-nft package have been deprecated in RHEL 9: https://access.redhat.com/solutions/6739041 |
The project netavark has nftables support now, and it claims:
|
So what is the recommended way to deal with this issue until nftables is supported? |
In the short term if you use systemd you can link docker to the nftables service so it will restart when nftables is restarted. Kind of a hack but it works. On Debian this is what I added to my
I did this with my fail2ban service as well. |
So I got my setup (WSL2 Fedora 41 with podman and docker-compose) running again by changing the driver to iptables as shown on this wiki-page (NetavarkNftablesDefault#How_To_Test). Simply replace the driver name with |
Is there any configuration option to configure dockerd / moby / containerd to use nftables natively for firewalling?
I have a debian machine with docker and nftables, but my docker iptables rules get overwritten by nftables once they get restarted / reloaded.
My alternatives are set to iptables-nft for iptables as per Debian 12.
Does docker support nftables?
Ideally I would want my nftables rules be dynamically merged with any docker firewall rules.
Thanks in advance.
The text was updated successfully, but these errors were encountered: