Error Codes Wiki

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

  1. 1Test connectivity: run "ping 8.8.8.8" in WSL — if this works but DNS fails, it is a DNS issue
  2. 2Fix DNS manually: edit /etc/resolv.conf and set nameserver to 8.8.8.8 or 1.1.1.1
  3. 3Prevent auto-generation: create /etc/wsl.conf with [network] generateResolvConf=false
  4. 4For VPN issues: add WSL routing rules — wsl.exe requires special routes when VPN is active
  5. 5Restart WSL: run "wsl --shutdown" in PowerShell then relaunch your Linux distribution

Tags

wsl2networkingdnsvpnresolv-conf

More in System

Frequently 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.