I can't use ufw on WSL-Ubuntu
Because you don't have a Linux kernel.
ufw
is a frontend for netfilter
. Netfilter is the Linux Kernels support for filtering IP packets. Windows has a different mechanism, commonly named Windows Firewall.
ufw
only supports netfilter, not Windows Firewall or other IP filtering technologies. It thus only works on systems with a Linux kernel.
The man page mentions this:
This program is for managing a Linux firewall and aims to provide an easy to use interface for the user.
Some tools are really not portable to different platforms. This includes tools that, like ufw
, attempts to interface the operating system kernel.
Related videos on Youtube
Admin
Updated on September 18, 2022Comments
-
Admin over 1 year
I use Windows 10 home (build 17134.471) with WSL-Ubuntu 16.04 (xenial).
I executed
apt update -y && ufw --force enable
and got the following trace (I don't know what it means - maybe some kernel functions missing thus some failed syscalls).Is there any way to use WSL-Ubuntu as for today anyway?
Trace:
ERROR: problem running ufw-init modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-17134-Microsoft/modules.dep.bin' modprobe: FATAL: Module nf_conntrack_ftp not found in directory /lib/modules/4.4.0-17134-Microsoft modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-17134-Microsoft/modules.dep.bin' modprobe: FATAL: Module nf_nat_ftp not found in directory /lib/modules/4.4.0-17134-Microsoft modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.0-17134-Microsoft/modules.dep.bin' modprobe: FATAL: Module nf_conntrack_netbios_ns not found in directory /lib/modules/4.4.0-17134-Microsoft iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 1 Try `iptables-restore -h' or 'iptables-restore --help' for more information. iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 1 Try `iptables-restore -h' or 'iptables-restore --help' for more information. iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 1 Try `iptables-restore -h' or 'iptables-restore --help' for more information. iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 1 Try `iptables-restore -h' or 'iptables-restore --help' for more information. iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 1 Try `iptables-restore -h' or 'iptables-restore --help' for more information. iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 12 Try `iptables-restore -h' or 'iptables-restore --help' for more information. iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 12 Try `iptables-restore -h' or 'iptables-restore --help' for more information. iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 1 Try `iptables-restore -h' or 'iptables-restore --help' for more information. iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 1 Try `iptables-restore -h' or 'iptables-restore --help' for more information. iptables-restore v1.6.0: iptables-restore: unable to initialize table 'filter' Error occurred at line: 1 Try `iptables-restore -h' or 'iptables-restore --help' for more information. Problem loading ipv6 (skipping) Problem running '/etc/ufw/before.rules' Problem running '/etc/ufw/after.rules' Problem running '/etc/ufw/user.rules'
-
Timo over 3 yearsTaken from wiki.ubuntu.com: WSL2 features a Linux kernel running inside Windows 10 and is built on the core technology of Hyper-V to provide better Linux application support and improved file performance . I use WSL2 and cannot access internet since installing
ufw
. Do I have to uninstallufw
and reboot? -
Jplus2 almost 3 years@Timo Just disable it I think? sudo ufw disable