WSL 2 internet connectivity is gone

indrajeet gour 16 Reputation points
2022-05-17T18:20:17.247+00:00

I had issue with frequent disconnection of internet on my laptop from WI-FI.

I contacted with local IT support on my company, they see the network connection from control panel and updated the "WSL 2 virtualized ethernet" IP4 setting from static to dynamic.

Since than I can able to access the internet on my laptop browser but WSL does not even ping to google.com.

Would any one help on this case, thanks a lot in advance.

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,478 questions
Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,362 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,661 Reputation points
    2022-05-24T07:33:47.657+00:00

    Hello

    Thank you for your question and reaching out. I can understand you are having issues related to Internet connection to WSL.

    The reason this error occurs is because Windows automatically generates resolv.conf file with wrong nameserver.

    On your Windows Machine run following commands.

    netsh winsock reset
    netsh int ip reset all
    netsh winhttp reset proxy
    ipconfig /flushdns

    On your WSL Terminal :
    Locate the file by running the following command:

    sudo nano /etc/resolv.conf

    This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/resolv.conf

    [network]

    generateResolvConf = false

    nameserver 8.8.8.8


    --If the reply is helpful, please Upvote and Accept as answer--

    9 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.