我不能在 WSL-Ubuntu 上使用 ufw

3 security firewall ufw windows-subsystem-for-linux

我将 Windows 10 家庭版(内部版本 17134.471)与 WSL-Ubuntu 16.04(xenial)一起使用。

我执行apt update -y && ufw --force enable并得到以下跟踪(我不知道这意味着什么 - 也许缺少一些内核函数,因此一些失败的系统调用)。

无论如何,有没有办法像今天一样使用 WSL-Ubuntu?

痕迹:

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'
Run Code Online (Sandbox Code Playgroud)

vid*_*rlo 5

因为你没有Linux内核。

ufw是 的前端netfilter。Netfilter 是用于过滤 IP 数据包的 Linux 内核支持。Windows 具有不同的机制,通常称为 Windows 防火墙。

ufw仅支持 netfilter,不支持 Windows 防火墙或其他 IP 过滤技术。因此,它仅适用于具有 Linux 内核的系统。

手册页提到了这一点:

This  program  is for managing a Linux firewall and aims to provide an
easy to use interface for the user.
Run Code Online (Sandbox Code Playgroud)

有些工具确实不能移植到不同的平台。这包括ufw尝试连接操作系统内核的工具,例如。