No internet connection WSL 2

Keny NBJ 0 Reputation points
2023-09-26T13:01:49.6333333+00:00

Hello,

I have an Internet access problem on all my WSL 2 virtual machines. They can't connect to the Internet.

I'm currently in a company network with a domain. My colleague and I have the same problem on two different Windows 11 machines.

We only have the default antivirus windows defender and I've already tried disabling it, but it didn't solve the problem.

We're working with laptops, and the virtual machines can only connect to the Internet if the laptop is connected via WiFi. By connecting the laptop to the network via the ethernet cable, we can no longer access the network from WSL.

I've tried resetting the network parameters via the reset to factory settings button, but it doesn't make any difference.

For the moment, our solution is to work on Wifi, but it's not pleasant for us.

Is it possible to get help with this problem?

If you need any further information, please don't hesitate to contact me.

Windows for business | Windows Client for IT Pros | Networking | Network connectivity and file sharing
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,751 Reputation points
    2023-09-27T08:42:29.4066667+00:00

    Hello,

    Initially should not be a challenge for WSL2 to connect through the Ethernet cable. Bear in mind that in some networks, specially corporate, both Ethernet and Wireless may have different settings that need to be configured in the virtual machine in order to be able to connect. Based on the premises and tests you performed, I would recommend to look into:

    1.Check Network Adapter Settings: Ensure that the network adapter of your WSL 2 virtual machine is set to the correct network profile. In some cases, it might be set to "Public," which can restrict network access. You can change this in the Hyper-V Manager settings for your VM.

    1. Check Firewall Settings: in case of doubt, you can define Inbound and Outbound ruled both for WSL2 machine or per application. By default the ports needed by WSL are 80, 443 and 22
    2. Check if the DNS configuration is correct for the Ethernet connection

    Run the next command in WSL to see the configuration with cable and also with Wifi, to detect differences: cat /etc/ resolv.conf

    1. Check for proxy settings.

    You can edit proxy settings if need in the distribution, for example for Ubunto it should be the file "/etc/environment"

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

    0 comments No comments

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.