刚装完WSL2的Ubuntu子系统时,可能无法ping通本地主机的ip:
WSL2系统ip:

本地主机ip:
在powershell里输入如下的命令:
bash
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL (Hyper-V firewall))" -Action Allow

然后输入:
bash
wsl --shutdown

结果如下:
ping通了,完美解决!!!