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

[BUG] WSL2 loses internet connection when Mobile Hotspt is turned on #10146

Open
1 of 2 tasks
ZikaZaki opened this issue May 27, 2023 · 13 comments
Open
1 of 2 tasks

[BUG] WSL2 loses internet connection when Mobile Hotspt is turned on #10146

ZikaZaki opened this issue May 27, 2023 · 13 comments
Assignees
Labels

Comments

@ZikaZaki
Copy link

Windows Version

Microsoft Windows 11 [Version 21H2] [OS Build 22000.1936)

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.90.1

Distro Version

Ubuntu 20.04

Other Software

Visual Studio Code 1.77.2 with Remote WSL-Extension 0.77.0

Repro Steps

  1. Open WSL2 on a Windows 11 machine.
  2. Connect to the internet.
  3. Turn on Mobile Hotspot on the same Windows 11 machine.
  4. Observe that the WSL2 loses internet connection.

Expected Behavior

The WSL2 should maintain its internet connection when the Mobile Hotspot is turned on in the Windows 11 machine.

Actual Behavior

When a user turns on Mobile Hotspot on their Windows 11 machine, the WSL2 loses internet connection and is unable to connect to any external network resources. The WSL2 network adapter appears to be disconnected and cannot be reconnected until the Mobile Hotspot is turned off.

❗ NOTE: This bug only affects WSL2 and NOT the Windows host machine.

Example: Running the sudo apt update && sudo apt upgrade command will fail to update the packages and report errors, as shown below in the screenshots.

Screenshots

wsl bug
wsl bug 2

Diagnostic Logs

No response

@jeremydierx
Copy link

jeremydierx commented May 30, 2023

Same issue from Windows 11 / Wsl2. Have you solved it?

@ZikaZaki
Copy link
Author

ZikaZaki commented May 30, 2023

@jeremydierx
not yet, I'm trying to figure it out.

@jeremydierx
Copy link

New! Connection sharing with WSL does not work with my iphone 12 mini but works with my Huawei 30 pro. So the problem is related to the iPhone and I think it comes from the latest update from Apple...

@keith-horton
Copy link
Member

This sounds like 2 different configurations: one is enabling Hotspot so other devices can connect through this host device running WSL; the other scenario is having the host device connect through another phone as its network connection. Is that right?

In both cases, can you please share the host ip connectivity state? "Get-NetIPInterface", "Get-NetRoute" ?

@tonyhabib01
Copy link

tonyhabib01 commented Sep 26, 2023

@ZikaZaki I have the same problem, have you solve it ?

@francip
Copy link

francip commented Oct 27, 2023

This reproes with WSL2 on Windows 11 tethered to an iPhone 15 Pro Max. Windows has full connectivity to internet:

PS C:\Users\Franci Penov\src\dashai> git pull
Already up to date.

Ubuntu in WSL2 cannot connect:

francip francip-laptop ~/src/dashai [git main] $ git pull
fatal: unable to access 'https://github.com/francip/dashai.git/': Failed to connect to github.com port 443 after 154 ms: No route to host

@francip
Copy link

francip commented Oct 27, 2023

Restarting WSL2 does not help.
Get-NetIPInterface in the host:

PS C:\Users\Franci Penov\src\dashai> Get-NetIPInterface

ifIndex InterfaceAlias                  AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp     ConnectionState PolicyStore
------- --------------                  ------------- ------------ --------------- ----     --------------- -----------
40      vEthernet (WSL)                 IPv6                  1500              15 Enabled  Connected       ActiveStore
14      Local Area Connection* 2        IPv6                  1500              25 Disabled Disconnected    ActiveStore
10      Bluetooth Network Connection    IPv6                  1500              65 Disabled Disconnected    ActiveStore
7       Local Area Connection* 1        IPv6                  1500              25 Disabled Disconnected    ActiveStore
8       Ethernet                        IPv6                  1500               5 Enabled  Disconnected    ActiveStore
17      Wi-Fi                           IPv6                  1440              35 Enabled  Connected       ActiveStore
1       Loopback Pseudo-Interface 1     IPv6            4294967295              75 Disabled Connected       ActiveStore
40      vEthernet (WSL)                 IPv4                  1500              15 Disabled Connected       ActiveStore
14      Local Area Connection* 2        IPv4                  1500              25 Enabled  Disconnected    ActiveStore
10      Bluetooth Network Connection    IPv4                  1500              65 Enabled  Disconnected    ActiveStore
7       Local Area Connection* 1        IPv4                  1500              25 Enabled  Disconnected    ActiveStore
8       Ethernet                        IPv4                  1500               5 Enabled  Disconnected    ActiveStore
17      Wi-Fi                           IPv4                  1500              35 Enabled  Connected       ActiveStore
1       Loopback Pseudo-Interface 1     IPv4            4294967295              75 Disabled Connected       ActiveStore

Also, in Control Panel:

wsl-disconnected

@keith-horton
Copy link
Member

keith-horton commented Oct 27, 2023

Hi there. we'll need a trace to see what's going on. Can you please run this - then startup the WSL container (while traces are running)? Here's the link to our script: https://github.com/microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1

Can you also run "netsh nlm query all nlmquery.log" - and attach that log file with the above traces?

Thanks

@vvavrychuk
Copy link

For me steps to reproduce are a bit more complicated:

  1. Connect to Ethernet, verify WSL has Internet:
> traceroute 1.1.1.1
traceroute to 1.1.1.1 (1.1.1.1), 30 hops max, 60 byte packets
 1  HOSTNAME (172.24.32.1)  0.340 ms  0.309 ms  0.303 ms
 2  192.168.0.1 (192.168.0.1)  1.096 ms  1.834 ms  1.829 ms
...

Here 172.24.32.1 is my "vEthernet (WSL)" IP and 192.168.0.1 is my router IP address.

  1. Disconnect from Ethernet and connect to Wi-Fi, verify WSL has Internet:
> traceroute 1.1.1.1
traceroute to 1.1.1.1 (1.1.1.1), 30 hops max, 60 byte packets
 1  HOSTNAME (172.24.32.1)  0.247 ms  0.227 ms  0.222 ms
 2  router.lan (192.168.1.1)  2.683 ms  2.679 ms  2.830 ms

192.168.1.1 is my another router IP address.

  1. Enable "Mobile hotspot", WSL has no internet anymore
> traceroute 1.1.1.1
traceroute to 1.1.1.1 (1.1.1.1), 30 hops max, 60 byte packets
 1  HOSTNAME (172.24.32.1)  0.291 ms  0.256 ms  0.251 ms
 2  192.168.0.5 (192.168.0.5)  1782.022 ms !H * *

192.168.0.5 used to be my ethernet adapte IP address when I was connected to Ethernet.

Workaround

> Remove-NetRoute -DestinationPrefix 0.0.0.0/0 -InterfaceIndex 5

FYI @keith-horton

@LuckyLub
Copy link

LuckyLub commented Dec 6, 2024

Experincing same issue

  • WSL2
  • iPhone 13 Pro
  • iOS 18.1.1
  • Microsoft Windows 11 Pro
  • Version 10.0.22631 Build 22631

How can I help?

@CatalinFetoiu
Copy link
Collaborator

hi, if you are experiencing the issue can you please collect networking logs using the instructions here. The script will generate a zip with name starting with "WslNetworkingLogs"

thanks

@link89
Copy link

link89 commented Dec 9, 2024

I have the same problem recently. It's like another problem I had occurred before, which is network broken when VPN is on. And it turns out that the same solution for VPN also works for this Mobile WiFi Hotspot issue: https://github.com/sakai135/wsl-vpnkit

@LuckyLub
Copy link

I can confirm that the wsl-vpnkit is working for me.

I made logs according to description and emailed a download link to [email protected], since I felt uncomfortable sharing it here.

  • I pinged 8.8.8.8 3 times. Unsuccessfully.
  • after which I enable the vpn kit and pinged 8.8.8.8 3 more times. Successfully.
  • After that I disabled the vpn kit and pinged 8.8.8.8 3 more times. Unsuccessfully.

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

10 participants