Cover image for Issue with WSL2 Archlinux Mirror Network Mode Unable to Access Network

Issue with WSL2 Archlinux Mirror Network Mode Unable to Access Network

Words 390
Views
Visitors

Timeline

Timeline

2025-10-03

init

This article introduces the issue where WSL2 Archlinux mirror network mode may fail to access the network after a restart under Win11, and summarizes how to distinguish DNS and firewall faults by checking gateway connectivity, thereby providing specific solutions such as disabling automatic DNS generation, allowing wsl.exe firewall permissions, and switching network modes.

Under the Mirrored network mode of Win11 + WSL2 archlinux, there is a probability that the issue of WSL being unable to access the network while Windows can will be triggered after a restart.

Environment
Environment

wsl configuration

1
2
3
4
5
6
7
8
9
[wsl2]
dnsTunneling=true # DNS Tunnel (to solve certain network issues)
firewall=true # Enable firewall integration
autoProxy=true # Automatically sync Windows proxy settings
networkingMode=Mirrored

[experimental]
hostAddressLoopback=true
bestEffortDnsParsing=true

ping gateway

First confirm whether you can ping the gateway.

  • If you can ping the IP but cannot access the domain name → it is a DNS issue
  • If you cannot even ping the IP → it is a network forwarding / network card / firewall issue
1
ping -c 4 8.8.8.8

DNS issue

1
2
3
4
sudo emacs /etc/resolv.conf
# Write the following configuration
nameserver 8.8.8.8
nameserver 1.1.1.1

To avoid being overwritten on every restart, you can disable automatic generation

1
2
sudo bash -c "echo '[network]' > /etc/wsl.conf"
sudo bash -c "echo 'generateResolvConf = false' >> /etc/wsl.conf"

Restart WSL

1
wsl --shutdown

Check if the network is restored

Firewall issue

Open Firewall and network protection in Windows Security Center:

Firewall and network protection
Firewall and network protection

Click Allow an app through firewall and add C:\Windows\System32\wsl.exe.
Check again if the network is restored.

Others

If the following error occurs:

1
2
3
4
wsl: 出现了内部错误。
错误代码: CreateInstance/CreateVm/ConfigureNetworking/0x8007054f
wsl: 无法配置网络 (networkingMode Mirrored),回退到 networkingMode None。
wsl: 检测到 localhost 代理配置,但未镜像到 WSL。NAT 模式下的 WSL 不支持 localhost 代理。
  1. You can try restarting
1
wsl --shutdown
  1. Try updating WSL and retry
1
wsl --update
  1. Or first switch to NAT mode in WSL Settings, then after successfully opening WSL, switch back to Mirrored mode

  2. If automatic DNS generation is turned off, try turning it on and setting it up/etc/wsl.confin thegenerateResolvConf = true