我无法在 WSL-Ubuntu 上使用 ufw

我无法在 WSL-Ubuntu 上使用 ufw

我使用 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'

答案1

因为你没有Linux内核。

ufw是一个前端netfilter。Netfilter 是 Linux 内核对 IP 数据包过滤的支持。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.

有些工具确实无法移植到不同的平台。其中包括ufw尝试与操作系统内核交互的工具。

相关内容