Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to internet #11512

Open
1 of 2 tasks
trilochan-kumar opened this issue Apr 25, 2024 · 11 comments
Open
1 of 2 tasks

Unable to connect to internet #11512

trilochan-kumar opened this issue Apr 25, 2024 · 11 comments
Labels

Comments

@trilochan-kumar
Copy link

Windows Version

Microsoft Windows [Version 10.0.22631.3447]

WSL Version

2

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146

Distro Version

Ubuntu 22.4.3 LTS

Other Software

No response

Repro Steps

Tried using the following commands:

sudo apt update

ping google.com

And also I tried updating the /etc/resolv.conf as follows:
GNU nano 6.2 /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

And updated the /etc/wsl.conf as follows:

  GNU nano 6.2                                          /etc/wsl.conf                                                   
[network]
generateResolvConf = false

[boot]
systemd=true

Expected Behavior

I expected it to connect to the internet, so that I can download multiple applications from the internet.

Actual Behavior

[Not updating and not even pinging to the google.]
ping: google.com: Temporary failure in name resolution

Diagnostic Logs

No response

@trilochan-kumar trilochan-kumar changed the title Unable to connect to internet. Unable to connect to internet Apr 25, 2024
Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@trilochan-kumar
Copy link
Author

Here are the logs....
WslLogs-2024-04-25_18-22-59.zip

Copy link

Diagnostic information
Detected appx version: 2.1.5.0

@OscBacon
Copy link

OscBacon commented Apr 25, 2024

+1 also getting this issue
And have to shutdown wsl and restart

@trilochan-kumar
Copy link
Author

trilochan-kumar commented Apr 25, 2024

Shutted down the wsl using wsl --shutdown command and also restarted the laptop. But still no change when I tried ping google.com command in Ubuntu Terminal.

@kardeiz
Copy link

kardeiz commented Apr 30, 2024

I'm also having this issue with WSL2 on Microsoft Windows [Version 10.0.19045.4291]. It started sometime in the last 5-10 days...

@S1RENS
Copy link

S1RENS commented May 6, 2024

I have this issue. If I allow Hyper-V firewall outbound connections it works, but I don't know if this is a safe practice.

@neatchee
Copy link

Recent changes in the latest version of Windows 11 have made it so that the Hyper-V Network Firewall blocks inbound and outbound traffic by default.

The ONLY default rules that exist are for ICMP (v4 and v6)

In order to get connectivity working again, it is currently necessary to use Powershell on the host machine to create new Hyper-V Firewall rules allowing the necessary traffic.

For example, if we want 'nslookup' to work from an Ubuntu WSL2 install, we need to create a rule to allow outbound traffic on port 53 through the Hyper-V Firewall

New-NetFirewallHyperVRule -Name DNS-Out:TCP -DisplayName "DNS-Out:TCP" -Direction Outbound -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Protocol TCP -RemotePorts 53
New-NetFirewallHyperVRule -Name DNS-Out:UDP -DisplayName "DNS-Out:UDP" -Direction Outbound -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Protocol UDP -RemotePorts 53

And to allow standard web traffic, we need to allow ports 80 and 443 (TCP only)

New-NetFirewallHyperVRule -Name HTTP/S-Out -DisplayName "HTTP/S-Out" -Direction Outbound -VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Protocol TCP -RemotePorts 80,443

You can read about how to manage Hyper-V firewall rules here: https://learn.microsoft.com/en-us/windows/security/operating-system-security/network-security/windows-firewall/hyper-v-firewall

............................................

With that out of the way, time for my personal opinion:

This is awful. Truly awful. There is no GUI option for managing HyperV firewall rules. There was no warning that this change was coming. There is no indication to the average WSL user that this is the cause of the problem. And there is no reasonable default configuration for the HyperV firewall.

I am not looking forward to managing these rules going forward. What a nightmare.

@chanpreetdhanjal
Copy link

Hi. Can you please collect networking logs by following the instructions below?
https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

@neatchee
Copy link

Hi. Can you please collect networking logs by following the instructions below? https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues

Would you like the logs with or without the Hyper-V firewall rules I described above?

@CatalinFetoiu
Copy link
Collaborator

@neatchee I see you encounter a "Temporary failure in name resolution" - can you please try enabling dnsTunneling and see if that resolves the problem?

If you still encounter the problem after doing this, please collect networking logs

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants