No internet connection in WSL

Fix No Internet connection in WSL on Windows 11/10

Recently one user reported that there is no active internet connection inside WSL, without an internet connection, he is not able to perform the basic tasks such as updating packages. This article will guide you to fix No Internet connection in WSL, there may be several reasons that cause this type of issue, basically, WSL hooks into your Windows PC network connectivity. If there is any issue with the Windows PC network, it may break the internet inside the Linux environment. If you are facing a similar issue, then follow the below-mentioned steps to resolve the issue.

Fix No Internet connection in WSL:

Once you encounter this issue, try to reset the network connection on your Windows PC, I used the following commands to fix this issue, I have created a script to resolve this, Open Notepad copy-paste the following script, and save it as a batch file.

@echo off
echo Shutting down WSL...
wsl --shutdown

echo Resetting Winsock...
netsh winsock reset

echo Resetting IP configuration...
netsh int ip reset all

echo Resetting WinHTTP proxy...
netsh winhttp reset proxy

echo Flushing DNS cache...
ipconfig /flushdns

echo Resetting Winsock again...
netsh winsock reset

echo Restarting the computer...
shutdown /r /t 0

Run the batch file, First, this will shut down the WSL, reset the network setting, and flush the DNS.

Once you execute the batch file, launch the WSL distro again and check the connectivity. If you have multiple WSL distros facing the same issue, then this might fix this problem.

Read Also:

How to remove WSL Linux distro using PowerShell in Windows 11?

How to install WSL2 in Windows 11?

How to Install WSL using Command Prompt in Windows 11?

Fix WslRegisterDistribution failed with error 0x80004005 in Windows 11

Fix Process Exited with Code 4294967295 in WSL on Windows 11

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top