Fetching latest headlines…
How I Fixed WSL2's "100% Packet Loss" Networking Bug in Under 10 Minutes
NORTH AMERICA
🇺🇸 United StatesJuly 6, 2026

How I Fixed WSL2's "100% Packet Loss" Networking Bug in Under 10 Minutes

1 views0 likes0 comments
Originally published byDev.to

If you've ever launched Ubuntu in WSL2 only to discover there's no internet connectionping fails, DNS doesn't resolve, and apt update hangs forever—you're not alone.

I recently ran into this issue while my Windows host had a perfectly working internet connection, yet my WSL2 instance behaved as if it were completely offline.

After trying nearly every solution recommended online, the fix turned out to be surprisingly simple.

This post explains what didn't work, what actually fixed it, and why.

The Problem

Inside my WSL2 Ubuntu 24.04 instance:

ping 8.8.8.8

returned:

100% packet loss

Trying DNS wasn't any better:

ping google.com

produced:

Temporary failure in name resolution

Even basic package management failed:

sudo apt update

It simply timed out because the Linux environment had no network connectivity.

Meanwhile...

  • ✅ Windows could browse the web normally.
  • ✅ Wi-Fi was connected.
  • ✅ Other Windows applications had internet access.

The problem existed only inside WSL2.

What Didn't Work

Like many developers, I followed the usual troubleshooting advice first.

Unfortunately, none of these solved the issue:

  • Editing /etc/resolv.conf
  • Making resolv.conf immutable using chattr
  • Running:
netsh winsock reset
  • Running:
netsh int ip reset
  • Restarting WSL
  • Restarting Windows
  • Manually configuring DNS servers

These are common fixes for DNS problems, but in my case the issue was much deeper.

The real culprit wasn't DNS.

It was the virtual networking layer that WSL2 uses.

The Fix: Enable Mirrored Networking

The solution was adding a .wslconfig file in my Windows user profile.

Open PowerShell as Administrator and run:

notepad "$env:USERPROFILE\.wslconfig"

Add the following configuration:

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

Save the file.

Then completely shut down WSL:

wsl --shutdown

Finally, start WSL again:

wsl

That's it.

Immediately afterwards:

ping 8.8.8.8

returned:

3 packets transmitted, 3 received, 0% packet loss

Network connectivity was restored.

Why This Works

By default, WSL2 uses a NAT-based virtual network adapter.

Think of it as a virtual switch sitting between Windows and Linux.

Normally this works well, but it can become corrupted or misconfigured after:

  • Windows updates
  • Sleep and wake cycles
  • VPN usage
  • Firewall changes
  • Hyper-V networking issues

When that virtual switch breaks, your Linux instance loses its route to the outside world—even though Windows itself still has internet access.

Setting:

networkingMode=mirrored

changes how WSL2 connects to the network.

Instead of relying on a separate virtual NAT adapter, WSL2 mirrors the Windows host's network interface directly.

Adding:

dnsTunneling=true

allows DNS queries to flow through the Windows networking stack, avoiding many name-resolution issues.

In my case, disabling the WSL firewall with:

firewall=false

also eliminated the remaining networking restrictions.

The result was a stable connection that survived restarts and behaved much more reliably than the default NAT configuration.

Verify the Fix

After restarting WSL, test a few commands:

ping 8.8.8.8
ping google.com
curl https://example.com
sudo apt update

If all four work, your networking stack has been restored successfully.

Key Takeaway

If:

  • Windows has internet,
  • WSL2 does not,
  • ping 8.8.8.8 fails,
  • and every DNS tutorial you've tried hasn't helped,

there's a good chance the problem isn't DNS at all.

It's the virtual networking layer.

Enabling mirrored networking through .wslconfig solved the issue instantly for me, and it's now one of the first things I'll check whenever WSL2 suddenly loses connectivity.

Hopefully, it saves you the same hours of troubleshooting it saved me.

Have you run into other WSL2 networking issues?

I'm curious to hear what caused them and how you fixed them. Share your experience in the comments—your solution might help the next developer searching for "WSL2 no internet."

Comments (0)

Sign in to join the discussion

Be the first to comment!