You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft Windows [Version 10.0.19041.508]
Ubuntu 20.04
WSL 2
Steps to reproduce
After installing nftables (my version from repo: 0.9.3) and trying to configure named set in specified table - i'm getting an error.
$ sudo nft add table inet test_table
$ sudo nft add chain inet test_table test_chain {type filter hook input priority 0\;}
$ sudo nft add set inet test_table my_set {type ipv4_addr\;}
Error: Could not process rule: Operation not supported
add set inet test_table my_set {type ipv4_addr;}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expected behavior
The set must be created and displayed in listing (nft list ruleset)
Actual behavior
I got the following error: "Could not process rule: Operation not supported"
Reacted by Vasiliy Zyablitsev, Fredrik Larsson, Denys Pavlov, fjf2002, Kip Obenauf, grochoge, FrantaM, Kyle J Strand, cheezenaan, Daniel Lerch and 3 more
Is this being addressed? I can't run native docker without reverting back to legacy iptables, which I can imagine is not going to be around forever. What is a longer-term path to run native docker? Ticket 6655, which was closed as a dup of this, describes the symptoms/effect very well.
Reacted by fjf2002, Marius van Niekerk, Piotr Kapera, NyaMisty, Hoa Nguyen, Kyle J Strand and froldandiaz
I am facing same issue in ubuntu-22.04 Jammy release. Docker does not start here, due to below error.
failed to start daemon: Error initializing network controller: error obtaining controller instance: unable to add
return rule in DOCKER-ISOLATION-STAGE-1 chain: (iptables failed: iptables --wait -A DOCKER-ISOLATION-STAGE-1 -j RETURN: iptables v1.8.7 (nf_tables): RULE_APPEND failed (No such file or directory): rule in chain DOCKER-ISOLATION-STAGE-1
(exit status 4))
If you are running into this problem from an RPM-based distribution, many of the fixes given may not work for you. Specifically, I ran into this issue using the AlmaLinux-8 distro running under distrod (to enable the use of systemd). I originally went down the path of trying to find and install the legacy version of iptables (xtables-legacy-multi) to use the same fix mentioned above; however, after spending many hours in (unsuccessfully) trying to find that package in non-Fedora yum repositories, I pivoted to fixing the issue in the kernel instead.
As referenced by therealkenc, the issue of supporting the newer, nftables-based iptables is that the proper interfaces are not available in the standard WSL kernel; however, the interfaces exist in the code - they just need to be configured on / compiled in. Here is how I went about fixing the issue in AlmaLinux-8 (under distrod) starting from a fresh install:
Install requisite packages for building the kernel (thanks to this guide for pointing me in the right direction)
Clone the kernel repo: git clone https://github.com/microsoft/WSL2-Linux-Kernel.git kernel (note that the default checkout branch is probably what you will need, but run uname -r and make sure the version of kernel you have corresponds to the branch you are checked out to in the repo)
Configure the kernel build
cd kernel
cp Microsoft/config-wsl .config
make menuconfig
At this point, you are presented with a dialog text UI (TUI) that allows you to configure which modules are built into the kernel. Descend down into Networking Support → Networking options → Network packet filtering framework (Netfilter), and find any option having to do with nf_tables and enable it (including under the Core Netfilter Configuration sub-menu). I readily admit that I do not know which subset of these options is actually required for iptables using nf_tables to work, so I just blanket enabled them all.
(Optional) Exit back up to the top-level menu and go into General setup → Local version - append to kernel release, then change the name to something that reflects the kernel modifications (this is just to easily keep track of what kernel you are using at runtime)
Save and Exit back out of the menus
Build the kernel: make KCONFIG_CONFIG=.config -j $(nproc)
Copy the kernel outside of the VM: cp arch/x86/boot/bzImage /mnt/c/Users/<YOUR USER>/kernel
At this point, if you performed the optional step to give a custom kernel postfix, you can run uname -r to ensure you are using the new kernel. If so, then try restarting the docker daemon (i.e. sudo systemctl restart docker) and confirm that it is up and running.
I realize this is a heavy-handed approach, but I hope it can help any folks using an RPM-based distribution until the problem is officially addressed either by docker or by the WSL standard kernel.
Secondly, I realize that RPM-based distributions have moved towards the use of podman, but I have seen reports of similar issues with iptables, especially when using sudo podman, so hopefully this can help in that scenario as well. As a side note, if you want to be able to install both podman and docker at the same time in AlmaLinux-8 (for example, to play nicely with Jenkins pipelines or if podman features are unstable), you can follow this guide to do so.
Reacted by Pas, Henry Luengas, John Ericson and Sandro
If you are running into this problem from an RPM-based distribution, many of the fixes given may not work for you. Specifically, I ran into this issue using the AlmaLinux-8 distro running under distrod (to enable the use of systemd). I originally went down the path of trying to find and install the legacy version of iptables (xtables-legacy-multi) to use the same fix mentioned above; however, after spending many hours in (unsuccessfully) trying to find that package in non-Fedora yum repositories, I pivoted to fixing the issue in the kernel instead.
As referenced by therealkenc, the issue of supporting the newer, nftables-based iptables is that the proper interfaces are not available in the standard WSL kernel; however, the interfaces exist in the code - they just need to be configured on / compiled in. Here is how I went about fixing the issue in AlmaLinux-8 (under distrod) starting from a fresh install:
1. Install requisite packages for building the kernel (thanks to [this guide](https://kumekay.com/compiling-custom-kernel-for-wsl2/) for pointing me in the right direction)
1. `sudo dnf config-manager --set-enabled powertools`
2. `sudo dnf group install "Development Tools"`
3. `sudo dnf install ncurses-devel binutils-devel openssl-devel python39 dwarves`
2. Clone the kernel repo: `git clone https://github.com/microsoft/WSL2-Linux-Kernel.git kernel` (note that the default checkout branch is probably what you will need, but run `uname -r` and make sure the version of kernel you have corresponds to the branch you are checked out to in the repo)
3. Configure the kernel build
1. `cd kernel`
2. `cp Microsoft/config-wsl .config`
3. `make menuconfig`
4. At this point, you are presented with a `dialog` text UI (TUI) that allows you to configure which modules are built into the kernel. Descend down into **Networking Support** → **Networking options** → **Network packet filtering framework (Netfilter)**, and find any option having to do with nf_tables and enable it (including under the **Core Netfilter Configuration** sub-menu). I readily admit that I do _not_ know which subset of these options is actually required for iptables using nf_tables to work, so I just blanket enabled them all.
5. (Optional) Exit back up to the top-level menu and go into **General setup** → **Local version - append to kernel release**, then change the name to something that reflects the kernel modifications (this is just to easily keep track of what kernel you are using at runtime)
6. Save and Exit back out of the menus
4. Build the kernel: `make KCONFIG_CONFIG=.config -j $(nproc)`
5. Copy the kernel outside of the VM: `cp arch/x86/boot/bzImage /mnt/c/Users/<YOUR USER>/kernel`
6. Follow the [instructions for global WSL configuration](https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configuration-setting-for-wslconfig) to point to the kernel file you just copied
7. Shutdown WSL: `wsl --shutdown`
8. Re-launch your distro
At this point, if you performed the optional step to give a custom kernel postfix, you can run uname -r to ensure you are using the new kernel. If so, then try restarting the docker daemon (i.e. sudo systemctl restart docker) and confirm that it is up and running.
I realize this is a heavy-handed approach, but I hope it can help any folks using an RPM-based distribution until the problem is officially addressed either by docker or by the WSL standard kernel.
Secondly, I realize that RPM-based distributions have moved towards the use of podman, but I have seen reports of similar issues with iptables, especially when using sudo podman, so hopefully this can help in that scenario as well. As a side note, if you want to be able to install both podman and docker at the same time in AlmaLinux-8 (for example, to play nicely with Jenkins pipelines or if podman features are unstable), you can follow this guide to do so.
This worked for me running Rocky Linux in WSL2. Can't thank you enough, it's been causing me so many issues!
If you are running into this problem from an RPM-based distribution, many of the fixes given may not work for you. Specifically, I ran into this issue using the AlmaLinux-8 distro running under distrod (to enable the use of systemd). I originally went down the path of trying to find and install the legacy version of iptables (xtables-legacy-multi) to use the same fix mentioned above; however, after spending many hours in (unsuccessfully) trying to find that package in non-Fedora yum repositories, I pivoted to fixing the issue in the kernel instead.
As referenced by therealkenc, the issue of supporting the newer, nftables-based iptables is that the proper interfaces are not available in the standard WSL kernel; however, the interfaces exist in the code - they just need to be configured on / compiled in. Here is how I went about fixing the issue in AlmaLinux-8 (under distrod) starting from a fresh install:
1. Install requisite packages for building the kernel (thanks to [this guide](https://kumekay.com/compiling-custom-kernel-for-wsl2/) for pointing me in the right direction)
1. `sudo dnf config-manager --set-enabled powertools`
2. `sudo dnf group install "Development Tools"`
3. `sudo dnf install ncurses-devel binutils-devel openssl-devel python39 dwarves`
2. Clone the kernel repo: `git clone https://github.com/microsoft/WSL2-Linux-Kernel.git kernel` (note that the default checkout branch is probably what you will need, but run `uname -r` and make sure the version of kernel you have corresponds to the branch you are checked out to in the repo)
3. Configure the kernel build
1. `cd kernel`
2. `cp Microsoft/config-wsl .config`
3. `make menuconfig`
4. At this point, you are presented with a `dialog` text UI (TUI) that allows you to configure which modules are built into the kernel. Descend down into **Networking Support** → **Networking options** → **Network packet filtering framework (Netfilter)**, and find any option having to do with nf_tables and enable it (including under the **Core Netfilter Configuration** sub-menu). I readily admit that I do _not_ know which subset of these options is actually required for iptables using nf_tables to work, so I just blanket enabled them all.
5. (Optional) Exit back up to the top-level menu and go into **General setup** → **Local version - append to kernel release**, then change the name to something that reflects the kernel modifications (this is just to easily keep track of what kernel you are using at runtime)
6. Save and Exit back out of the menus
4. Build the kernel: `make KCONFIG_CONFIG=.config -j $(nproc)`
5. Copy the kernel outside of the VM: `cp arch/x86/boot/bzImage /mnt/c/Users/<YOUR USER>/kernel`
6. Follow the [instructions for global WSL configuration](https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configuration-setting-for-wslconfig) to point to the kernel file you just copied
7. Shutdown WSL: `wsl --shutdown`
8. Re-launch your distro
At this point, if you performed the optional step to give a custom kernel postfix, you can run uname -r to ensure you are using the new kernel. If so, then try restarting the docker daemon (i.e. sudo systemctl restart docker) and confirm that it is up and running.
I realize this is a heavy-handed approach, but I hope it can help any folks using an RPM-based distribution until the problem is officially addressed either by docker or by the WSL standard kernel.
Secondly, I realize that RPM-based distributions have moved towards the use of podman, but I have seen reports of similar issues with iptables, especially when using sudo podman, so hopefully this can help in that scenario as well. As a side note, if you want to be able to install both podman and docker at the same time in AlmaLinux-8 (for example, to play nicely with Jenkins pipelines or if podman features are unstable), you can follow this guide to do so.
I can confirm this fixes similar issues with podman, where port forwarding was essentially broken, in WSL2, Oracle Linux. Thanks ever so much 🙏
Would be great to have this fixed in the default kernel though!
Docker and WSL2 : Rocky Linux 9
iptables -A test0-in -p tcp --dport 1111 -m state --state NEW -m recent --set
Warning: Extension recent revision 0 not supported, missing kernel module?
iptables v1.8.8 (nf_tables): RULE_APPEND failed (No such file or directory): rule in chain
When activating nftables on NixOS I got a No such file or directory error on this line fib saddr . mark . iif oif exists accept and could get it to work by building a custom kernel with the following patch
diff --git a/arch/x86/configs/config-wsl b/arch/x86/configs/config-wsl
index 51935f9f2..365529760 100644
--- a/arch/x86/configs/config-wsl+++ b/arch/x86/configs/config-wsl@@ -1066,7 +1069,7 @@ CONFIG_NF_NAT_MASQUERADE=y
CONFIG_NETFILTER_SYNPROXY=y
CONFIG_NF_TABLES=y
CONFIG_NF_TABLES_INET=y
-# CONFIG_NF_TABLES_NETDEV is not set+CONFIG_NF_TABLES_NETDEV=y
CONFIG_NFT_NUMGEN=y
CONFIG_NFT_CT=y
CONFIG_NFT_COUNTER=y
@@ -1084,11 +1087,18 @@ CONFIG_NFT_REJECT=y
CONFIG_NFT_REJECT_INET=y
CONFIG_NFT_COMPAT=y
# CONFIG_NFT_HASH is not set
+CONFIG_NFT_FIB=y+CONFIG_NFT_FIB_INET=y
CONFIG_NFT_XFRM=y
CONFIG_NFT_SOCKET=y
# CONFIG_NFT_OSF is not set
# CONFIG_NFT_TPROXY is not set
# CONFIG_NFT_SYNPROXY is not set
+# CONFIG_NF_DUP_NETDEV is not set+# CONFIG_NFT_DUP_NETDEV is not set+# CONFIG_NFT_FWD_NETDEV is not set+CONFIG_NFT_FIB_NETDEV=y+# CONFIG_NFT_REJECT_NETDEV is not set
# CONFIG_NF_FLOW_TABLE is not set
CONFIG_NETFILTER_XTABLES=y
# CONFIG_NETFILTER_XTABLES_COMPAT is not set
@@ -1256,7 +1266,7 @@ CONFIG_NF_SOCKET_IPV4=y
CONFIG_NF_TABLES_IPV4=y
CONFIG_NFT_REJECT_IPV4=y
# CONFIG_NFT_DUP_IPV4 is not set
-# CONFIG_NFT_FIB_IPV4 is not set+CONFIG_NFT_FIB_IPV4=y
# CONFIG_NF_TABLES_ARP is not set
# CONFIG_NF_DUP_IPV4 is not set
# CONFIG_NF_LOG_ARP is not set
@@ -1295,7 +1305,7 @@ CONFIG_NF_SOCKET_IPV6=y
CONFIG_NF_TABLES_IPV6=y
CONFIG_NFT_REJECT_IPV6=y
# CONFIG_NFT_DUP_IPV6 is not set
-# CONFIG_NFT_FIB_IPV6 is not set+CONFIG_NFT_FIB_IPV6=y
# CONFIG_NF_DUP_IPV6 is not set
CONFIG_NF_REJECT_IPV6=y
CONFIG_NF_LOG_IPV6=y
Still happening in August 2025 - do we still need to build our own WSL2 kernel (per directions above from 2022)? Example error message from client containers is:
Something went wrong while trying to create an inference server Error: (HTTP code 500) server error - netavark (exit code 1): nftables error: "nft" did not return successfully while applying ruleset
To fix: netavark (exit code 1): nftables error: "nft" did not return successfully while applying ruleset
Need to podman machine ssh then sudo dnf install iptables-nft and sudo vi /etc/containers/containers.conf and add at end:
[network]
firewall_driver="iptables"
Then exit ssh CLI and restart podman - podman machine stop then podman machine start
Reacted by Matías González, Sean, Matthew Messinger and masonsxu
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.
Activity
zyablitsev commentedon Oct 17, 2020
I also have the same issue.
Environment
Microsoft Windows [Version 10.0.19041.572]
Debian 10
WSL 2
therealkenc commentedon Oct 26, 2020
therealkenc commentedon Jan 27, 2021
There are some others vs. Ububtu's expected kconfig:
kobenauf commentedon Mar 22, 2022
Is this being addressed? I can't run native docker without reverting back to legacy iptables, which I can imagine is not going to be around forever. What is a longer-term path to run native docker? Ticket 6655, which was closed as a dup of this, describes the symptoms/effect very well.
lygstate commentedon Apr 30, 2022
ping for this.
biwiki commentedon May 1, 2022
I have the same issue with Jammy
panktrip commentedon May 2, 2022
I am facing same issue in ubuntu-22.04 Jammy release. Docker does not start here, due to below error.
failed to start daemon: Error initializing network controller: error obtaining controller instance: unable to add
return rule in DOCKER-ISOLATION-STAGE-1 chain: (iptables failed: iptables --wait -A DOCKER-ISOLATION-STAGE-1 -j RETURN: iptables v1.8.7 (nf_tables): RULE_APPEND failed (No such file or directory): rule in chain DOCKER-ISOLATION-STAGE-1
(exit status 4))
kobenauf commentedon May 2, 2022
Pankaj Tripathi (@panktrip) I had to do something similar to what was referenced in another ticket.
panktrip commentedon May 3, 2022
Thanks a lot Kip Obenauf (@kobenauf) . This worked for me on Ubuntu-22.04 in WSL2.
crbeckle commentedon Jun 24, 2022
If you are running into this problem from an RPM-based distribution, many of the fixes given may not work for you. Specifically, I ran into this issue using the AlmaLinux-8 distro running under distrod (to enable the use of systemd). I originally went down the path of trying to find and install the legacy version of iptables (xtables-legacy-multi) to use the same fix mentioned above; however, after spending many hours in (unsuccessfully) trying to find that package in non-Fedora yum repositories, I pivoted to fixing the issue in the kernel instead.
As referenced by therealkenc, the issue of supporting the newer, nftables-based iptables is that the proper interfaces are not available in the standard WSL kernel; however, the interfaces exist in the code - they just need to be configured on / compiled in. Here is how I went about fixing the issue in AlmaLinux-8 (under distrod) starting from a fresh install:
sudo dnf config-manager --set-enabled powertoolssudo dnf group install "Development Tools"sudo dnf install ncurses-devel binutils-devel openssl-devel python39 dwarvesgit clone https://github.com/microsoft/WSL2-Linux-Kernel.git kernel(note that the default checkout branch is probably what you will need, but rununame -rand make sure the version of kernel you have corresponds to the branch you are checked out to in the repo)cd kernelcp Microsoft/config-wsl .configmake menuconfigdialogtext UI (TUI) that allows you to configure which modules are built into the kernel. Descend down into Networking Support → Networking options → Network packet filtering framework (Netfilter), and find any option having to do with nf_tables and enable it (including under the Core Netfilter Configuration sub-menu). I readily admit that I do not know which subset of these options is actually required for iptables using nf_tables to work, so I just blanket enabled them all.make KCONFIG_CONFIG=.config -j $(nproc)cp arch/x86/boot/bzImage /mnt/c/Users/<YOUR USER>/kernelwsl --shutdownAt this point, if you performed the optional step to give a custom kernel postfix, you can run
uname -rto ensure you are using the new kernel. If so, then try restarting the docker daemon (i.e.sudo systemctl restart docker) and confirm that it is up and running.I realize this is a heavy-handed approach, but I hope it can help any folks using an RPM-based distribution until the problem is officially addressed either by docker or by the WSL standard kernel.
Secondly, I realize that RPM-based distributions have moved towards the use of podman, but I have seen reports of similar issues with iptables, especially when using
sudo podman, so hopefully this can help in that scenario as well. As a side note, if you want to be able to install both podman and docker at the same time in AlmaLinux-8 (for example, to play nicely with Jenkins pipelines or if podman features are unstable), you can follow this guide to do so.hluengas commentedon Jul 27, 2022
This worked for me running Rocky Linux in WSL2. Can't thank you enough, it's been causing me so many issues!
wonson commentedon Nov 7, 2022
This does not really solved the problem. Even though you get a pass for matching comment here, you may still hit error when matching conntrack
pettermk commentedon Apr 4, 2023
I can confirm this fixes similar issues with podman, where port forwarding was essentially broken, in WSL2, Oracle Linux. Thanks ever so much 🙏
Would be great to have this fixed in the default kernel though!
sreemtech commentedon Feb 9, 2024
Docker and WSL2 : Rocky Linux 9
iptables -A test0-in -p tcp --dport 1111 -m state --state NEW -m recent --set
Warning: Extension recent revision 0 not supported, missing kernel module?
iptables v1.8.8 (nf_tables): RULE_APPEND failed (No such file or directory): rule in chain
Any Advise please ?
SuperSandro2000 commentedon Mar 8, 2024
When activating nftables on NixOS I got a
No such file or directoryerror on this linefib saddr . mark . iif oif exists acceptand could get it to work by building a custom kernel with the following patchSuperSandro2000 commentedon Mar 13, 2025
Nothing is resolved here
PeteDaGuru commentedon Aug 12, 2025
Still happening in August 2025 - do we still need to build our own WSL2 kernel (per directions above from 2022)? Example error message from client containers is:
Something went wrong while trying to create an inference server Error: (HTTP code 500) server error - netavark (exit code 1): nftables error: "nft" did not return successfully while applying ruleset
PeteDaGuru commentedon Aug 12, 2025
To fix: netavark (exit code 1): nftables error: "nft" did not return successfully while applying ruleset
Need to
podman machine sshthensudo dnf install iptables-nftandsudo vi /etc/containers/containers.confand add at end:Then exit ssh CLI and restart podman -
podman machine stopthenpodman machine startmicrosoft-github-policy-service commentedon Aug 13, 2026
This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.
Thank you!