%USERPROFILE%\\.wslconfig 中添加以下内容

[wsl2]
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true

然后终端执行 wsl --shutdown

References

Advanced settings configuration in WSL

https://github.com/microsoft/WSL/issues/10753