在wsl里关闭后并关闭这个页面再打开发现hyper防火墙选项就又开启了。
并且我在.wslconfig里也是firewall=false
各位佬,这应该怎么关啊?
谢谢佬!
TL;DR 这是 WSL2 Setting 的 UI bug.
因为你的 Networking Mode 设置了 Mirrored,而在 WSL2 的 Mirrored 模式下,是强依赖 Hyper-V Firewall 的,这是这一点目前在官方文档中并没有说明。
当你切换 Networking Mode 为 Nat 或者其他模式后,就会发现此问题不存在了。
具体可见 WSL2 源码: WSL/src/windows/common/WslCoreConfig.cpp at 259ec4e5a9ed75d5ba587feedd91253523f678c7 · microsoft/WSL · GitHub
// Hyper-V firewall must always be configured for Mirrored Mode.
// For NAT mode, we use the experimental config to determine if Hyper-V firewall should be enabled
if ((NetworkingMode::Mirrored == NetworkingMode) || enableFirewall)
{
FirewallConfig.Enable();
}