WSL 2 Networking Not Working — No Internet Access from Linux Subsystem
Errorsystem
Overview
Fix WSL 2 networking issues where Linux distributions have no internet access, DNS resolution fails, or cannot reach external hosts from inside WSL.
Key Details
- WSL 2 uses a virtual network adapter with NAT to provide network connectivity to Linux distributions
- DNS resolution inside WSL defaults to the host Windows DNS settings via auto-generated /etc/resolv.conf
- VPN software on Windows can break WSL 2 networking by changing routing tables
- Firewall rules on the Windows host can block WSL 2 network traffic
- WSL 2 runs in a lightweight VM with its own network stack separate from Windows
Common Causes
- VPN software (Cisco AnyConnect, GlobalProtect) changing routing tables and breaking WSL NAT
- DNS resolution failing because /etc/resolv.conf points to an unreachable DNS server
- Windows Firewall or third-party firewall blocking WSL 2 virtual adapter traffic
- Hyper-V virtual switch misconfigured after a Windows update
Steps
- 1Test connectivity: run "ping 8.8.8.8" in WSL — if this works but DNS fails, it is a DNS issue
- 2Fix DNS manually: edit /etc/resolv.conf and set nameserver to 8.8.8.8 or 1.1.1.1
- 3Prevent auto-generation: create /etc/wsl.conf with [network] generateResolvConf=false
- 4For VPN issues: add WSL routing rules — wsl.exe requires special routes when VPN is active
- 5Restart WSL: run "wsl --shutdown" in PowerShell then relaunch your Linux distribution
Tags
wsl2networkingdnsvpnresolv-conf
More in System
windows-C000021A-status-system-process-terminatedWindows Error 0xC000021A — STATUS SYSTEM PROCESS TERMINATED
Criticalwindows-C0000225-boot-configuration-errorWindows Error 0xC0000225 — Boot Configuration Error
Criticalwindows-C000000F-boot-selection-failedWindows Error 0xC000000F — Boot Selection Failed
Criticalwindows-80004005-unspecified-errorWindows Error 0x80004005 — Unspecified Error
Warningwindows-80070570-file-or-directory-corruptedWindows Error 0x80070570 — File or Directory Corrupted
Errorwindows-system-0xc0000185Windows Error 0xC0000185 — Boot Device Inaccessible
CriticalFrequently Asked Questions
VPN clients modify Windows routing tables. WSL 2 NAT traffic may be routed through the VPN tunnel which blocks or reroutes it. Some VPNs explicitly block local VM traffic. Configure VPN split tunneling to exclude WSL traffic.