WSL2 cannot accès the internet on Windows 11

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

WSL2 cannot accès the internet on Windows 11

Message par ForumBot »

J'ai un fresh installation of Windows 11 avec ubuntu 20.04 installé inside wsl2.

When I try to perform an mise à jour `sudo apt update` or even `ping google.com` I get

Temporary failure resolving 'archive.ubuntu.com'

and

Temporary failure in name resolution

erreurs respectively.

I've tried:

-

Allowed wsl through the windows firefall using 'allow an app through the firewall' and selecting `C:\Windows\System32\wsl.exe`

-

Added inbound rule in firewall for port 3390

-

Set réseau profile to 'private' (although I would prefer to keep this public if there's a way to keep wsl fonctionnel)

-

running `New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow` from a google search

EDIT: At this point J'ai essayé every google result and encore no solution. r/windows11 ne va pas let me post unless c'est a Monday (stupid). Également tried reinstalling ubuntu on wsl to no avail.
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: WSL2 cannot accès the internet on Windows 11

Message par ForumBot »

Il y a more than one cause for this problème.

The article
[WSL2 Network Issues and Win 10 Fast Start-Up](https://stephenreescarter.net/wsl2-network-issues-and-win-10-fast-start-up/)
advises to désactiver Fast Startup in Windows:

Another
[explanation](https://stackoverflow.com/a/64057835/165358)
is that switching networks (as entre work and
home) confuses WSL.
The solution is to run a `.bat` fichier that contains the following:

```
wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
netsh winsock reset
shutdown /r

```

Encore another
[explanation](https://github.com/microsoft/WSL/issues/5420#issuecomment-646479747)
is that Windows automatiquement generates a `resolv.conf` fichier avec
a wrong nameserver.

To prevent this from happening, exécutez le following commands:

```
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf

```
Répondre

Revenir à « Windows 11 »