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

Very slow network speed on WSL2 #4901

Open
carl-berg opened this issue Feb 16, 2020 · 299 comments
Open

Very slow network speed on WSL2 #4901

carl-berg opened this issue Feb 16, 2020 · 299 comments
Labels

Comments

@carl-berg
Copy link

carl-berg commented Feb 16, 2020

Windows build number: 10.0.19041.84
Dist: Ubuntu 18.04 LTS

I just installed WSL2 on my home computer for the first time and something i notice that i don't see on my work computer is that WSL2 has dramatically lower network speed (wget or git clone tested). Speeds on WSL seem to be about 10-20 kb/s wheras windows download speed seem to be correlating to my ISP spec of 100/10 Mbps or above.

@therealkenc
Copy link
Collaborator

Screencap speedtest-cli as a starting point.

$ sudo apt install speedtest-cli
$ speedtest-cli
[...]

image

@carl-berg
Copy link
Author

Okies, here's speedtest on windows, in the browser:
Speedtest_win

...and here's speedtest from wsl2:
Wpeedtest_wsl2

@acirulis
Copy link

Same here. Especially upload speed was drastically reduced - 36.61 -> 3.85 Mbit/s

@guilhermehrcosta
Copy link

Hi, same here. My download was drastrically reduced of 200Mbit/s to 2 Mbit/s. Is there a solution?

@AndrewGaspar
Copy link

I'm hitting this issue, as well. Very frustrating.

@kennethnipper
Copy link

I'm seeing same issue. Speedtest-cli in bash:
image

speedtest in Windows:
image

@tin-liu
Copy link

tin-liu commented Mar 14, 2020

Edit: After several reboots and adding the related folders as exceptions in Windows Defender as @jituanlin 's referred blog pointed out, and then tried removing the exceptions because I wanted to check which folder exception actually helped (so eventually theoretically equivalent to reboots-only, but who knows?), now in WSL Ubuntu Ver. 2 I have down = ~80 Mbit/s & up = ~4 Mbit/s. The upload is still about only 1/10 of the actual limit, but the download is up-to-standard now.

Also, the command speedtest is ~15 Mbit/s faster (download) than speedtest-cli for me.

Old comment:
Windows network faster than WSL Ubuntu Ver. 1 which faster than WSL Ubuntu Ver. 2 here:

  1. Windows Ookla on Web browser
    down ~88 Mbit/s
    up ~38 Mbit/s
  2. WSL Ubuntu Ver. 1 speedtest-cli
    down ~32 Mbit/s
    up ~4 Mbit/s
  3. WSL Ubuntu Ver. 2 speedtest-cli
    down ~3 Mbit/s
    up ~4 Mbit/s

Cheers

@jituanlin
Copy link

After follow this blog
My network/file access improve more than 5 times speed.

@rducom
Copy link

rducom commented Apr 8, 2020

Same here, really annoying. Disabling AV (defender) doesn't helps
image

@markgaze
Copy link

markgaze commented May 3, 2020

Same here. Getting about 7Mbit/s on WSL2 and 30+ in Windows.

Disabling Defender also made no difference for me either.

@Vildevil
Copy link

Vildevil commented May 15, 2020

Same here :
Windows and WSL :

  • Up 261mb/s
  • Down 248mb/s

WSL 2 :

  • Up 1.60mb/s
  • Down 0.08mb/s

@copeland3300
Copy link

copeland3300 commented May 15, 2020

Oddly, I'm getting decent results from the speedtest-cli, but things such as apt update are extremely slow, that is, less than a MB/s, where I'm used to seeing 30-40MB/s on my standard Ubuntu systems...

Speedtest results...

Retrieving speedtest.net configuration...
Testing from Verizon Fios (108.28.56.14)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by QTS Data Centers (Dulles, VA) [5.59 km]: 27.576 ms
Testing download speed................................................................................
Download: 427.07 Mbit/s
Testing upload speed......................................................................................................
Upload: 85.70 Mbit/s

apt update results

Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [94.0 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [30.5 kB]
Fetched 437 kB in 2s (197 kB/s)

@oliver-dungey
Copy link

Same issue here, dire network speed in WSL2. Performance with Linux or WSL is fine.

@aleled
Copy link

aleled commented May 30, 2020

I am experiencing the same

Speedteswt from WSL are poor compared to CMD

1

@mrorat
Copy link

mrorat commented May 30, 2020

Same here, Windows is about 60Mbps vs WSL2 14kbps !!!!

@arthurgeron
Copy link

I think it's useful to let people know that this doesn't happen to everyone, I'm getting my full speed here in WSL 2 on Windows 10 2004 (non Insider)
image

@didinele
Copy link

didinele commented Jun 2, 2020

Much more interesting for me!

On windows image

Over on my freshly intalled WSL2 image

Seems like download speed remained rather intact, however upload was heavily hit.

Windows 10 Enterprise version 2004, Ubuntu 18.04 LTS`

@rarora7777
Copy link

rarora7777 commented Jun 3, 2020

I'm seeing 249.94mbps down / 15.42mpbs up on Windows, which is pretty much what I expect from my ISP. On WSL2, sppedtest-cli shows 4.69mbps down / 3.29mbps up.

But apt and git performance in WSL2 is so much worse. I'm getting download speeds of 4–16 kbps on both.

I don't recall measuring network speed on WSL1, but such terrible performance would have been quickly noticed.
Edit: Just installed a WSL1 Ubuntu 20.04 LTS and I got 193.61 mbps down / 16.94 mbps up.

I'm on Windows 10 Enterprise version 2004 (build 19041.264) and Ubuntu 18.04 LTS that I recently upgraded to WSL2.

@BeErikk
Copy link

BeErikk commented Jun 4, 2020

Just FYI. I have experienced extremely slow network speed as well, but it seems to be a temporary issue. Perhaps a local network issue? Right now in WSL 1 (2004 not insider) I get:

speedtest-cli
Retrieving speedtest.net configuration...
Testing from AllTele (XX.XX.XX.XXX)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by A3 Allmänna IT - och Telekomaktiebolaget (Stockholm) [162.45 km]: 12.928 ms
Testing download speed................................................................................
Download: 124.83 Mbit/s
Testing upload speed......................................................................................................
Upload: 122.34 Mbit/s

@JennToo
Copy link

JennToo commented Jun 5, 2020

I was having a similar issue and found that switching from Wifi to Ethernet helped.
I don't really understand why, as speedtests over my Wifi are fine outside of WSL2. I suppose it's possible that the Ethernet driver is somehow interacting with WSL and/or HyperV better.

Ethernet NIC is a "Killer E2500 Gigabit"
WiFi is a "Killer Wireless n/a/ac 1535" (though the only thing it seemed to "Kill" was my network performance 😄)

@dvsmaxv
Copy link

dvsmaxv commented Jun 9, 2020

Hello friends,
I'm not good at English, But me too I faced the same issue and I tried so many time and finally I got one solution and here's the url: https://www.hitxp.com/articles/software/ubuntu-fix-slow-wireless-internet-connection-speed-upgrading-11-04-natty-narwhal/. With sample pic

Screenshot from 2020-06-09 22-05-31

@matze19999
Copy link

don't have the problem on surface pro x (arm64)

@mrorat
Copy link

mrorat commented Jun 10, 2020

It gets better... my speedtest today (Ethernet):
WSL2:
Download: 45.98 Mbit/s
Upload: 3.39 Mbit/s

Windows:
Download: 46.5 Mbit/s
Upload: 17.8 Mbit/s

@takizo
Copy link

takizo commented Jun 10, 2020

Hi all, I got the latest Windows 10 ver 2004 update. Switching from WSL1 to WSL2. I have the similar slow issue like you all had. But not particularly on the internet, it's more on Windows to Ubuntu via localhost access

Windows Version: 2004
Build: 19041.264
Ubuntu: 18.04.4

I run php development in WSL with Ubuntu 18.04.4, I have apache2, php7.2 and MariaDB running very well on WSL1

During development, I usually tunnel to my server to load ElasticSearch/Postgresql data, the tunnel is listen on localhost with respective port numbers.

I do not have connection problem when running in WSL1, the speed is tremendous fast. It's fast like the data is loading on my machine itself.

But when I switch to WSL2, I notice the connection is extremely slow. The initial loading took like 5-7 secs. Then the page would rendered. The hostname is mapped to 127.0.0.1, I've tried mapped on WSL2 Ubuntu private IP, the results are the same - Slow.

I've capture the video and sharing with you all.

Here is the video running on WSL1

https://www.youtube.com/watch?v=tNFtUUd2sG4

What I did was wsl --set-version Ubuntu 2, to upgrade the current Ubuntu distro to WSL2. Here is the video of the same development site running on WSL 2 (Please look at left bottom status bar)

https://www.youtube.com/watch?v=JFYgzMHf2RU

I've tried the comments on this thread, no luck getting it load fast like WSL 1. Hopefully this can be fixed,

I've switched back to WSL1 and the speed is back to normal. You may refer to the video below, the result is instance.

https://www.youtube.com/watch?v=9Q5Ors94lJM

@zhqu1148980644
Copy link

zhqu1148980644 commented Feb 13, 2023

Same for windows11 ws2 ubuntu, I used iperf3 within ubuntu and get <2 Mbps, while 1000Mbs in windows host.

@realJustinLee
Copy link

Same here.
Windows 300Mbps down, 50Mbps up.
WSL 10Mbps down, 10Mbps up

@REFSZIN

This comment was marked as off-topic.

@data-platform-eng
Copy link

On my side connection to Python Pip is impossible (always timeout) because of this issue. I have tried several fixes all over this thread and others i found on the internet but none worked.

It seems like the issue is exclusive to WIFI connection only on my side :
That means that my connection seems "fine" when I use my phone shared internet.

@Zerogoki00
Copy link

Nothing was able to fix it for me until I replaced network adapter. Now I get full speed in WSL2

@thegame4craft
Copy link

At my Windows 10 installation, there isn't any wsl adapter. I found a other article but it didn't helped.

@krook1024
Copy link

The issue still persists, very confusing indeed.

@pshiro23
Copy link

Allow internet connection sharing on network adapter. Worked for me in a sec.

Screenshot 2023-02-23 082754

@realJustinLee
Copy link

Allow internet connection sharing on network adapter. Worked for me in a sec.

Screenshot 2023-02-23 082754

This will break wired Ethernet connection

@Epskampie
Copy link

This worked for me: https://answers.microsoft.com/en-us/windows/forum/all/low-internet-speed-in-wsl-2/21524829-18be-4611-bb5f-cabccd2cae31

@bartobri
Copy link

bartobri commented Mar 4, 2023

Chiming in. I just switched to WSL2 to do work on a leveldb database which wasn't working on WSL1 (known unrelated issue, I guess). So WSL2 fixed the database issue, but introduced a network issue. I have a program that was sending up to 1000 json-rpc requests per second on the local lan form one machine to another. Once I installed WSL2, it dropped to about 50 per second. And the strange thing is, they come is waves rather than a steady trickle. It will dump 50 responses and then pause for a second, dump 50 more and pause for a second, etc. It's really strange. If I switch back to WSL1 the problem goes away and I am back to 1000 requests per second.

@bartoszek
Copy link

@maxjf1 Resolves speed problem, but breaks resolve for my Arch WSL image ¯_(ツ)_/¯ have to manually set my router ip add in /ets/resolve.conf for name resolution to works.

@Pargar2083
Copy link

did anyone find a solid answer? i'm having this same problem and I literally tried every single commented method but the speed is still extremely low

@Rowanto
Copy link

Rowanto commented Mar 12, 2023

Allow internet connection sharing on network adapter. Worked for me in a sec.

Screenshot 2023-02-23 082754

This one worked for me.

Edit: It doesn't work anymore. It seems the only thing whick worked is to disable the network adapter in windows and enable it again.

@prettydeep
Copy link

@Zerogoki00 What specific network adapter are you now using?

@JTM29
Copy link

JTM29 commented Mar 16, 2023

So funnily enough, I changed my motherboard from ASUS to an MSI due to an unrelated problem, but I just noticed my WSL internet speeds are now matching the host PC speeds.

@CharlesScoville
Copy link

I too can confirm that turning off "Large Send Offload" in the virtual network adapter for WSL2 worked for me. I DO NOT have an Asus NIC, or anything Asus. I have a LEnovo Legion and I am using a Netgear wireless adapter.

I am now finding that the setting does not persist after reboot, which I should have figured. Still fixes the problem for me when steps are repeated.

@arnavmehta7
Copy link

I don't have any WSL2 Adapter showing in my control panel

@xenonhammer
Copy link

xenonhammer commented Mar 30, 2023

@jjensen

Disable-NetAdapterBinding -Name "vEthernet (WSL)" -ComponentID ms_tcpip6 -IncludeHidden # disable ipv6
Disable-NetAdapterLso -Name "vEthernet (WSL)" -IncludeHidden # Seems to disable the large packet. Didn't tested it since mine was already disabled

Get-NetAdapterBinding -IncludeHidden -Name "vEthernet (WSL)" # Check if ipv6 was disabled
Get-NetAdapterAdvancedProperty -IncludeHidden -Name "vEthernet (WSL)" # Check if large packet was disabled

I was not seen vEthernet (WSL) adapter in my control panel in windows too. I open my wsl and run ipconfig.exe /all. Adapter Ethernet vEthernet (WSL) was being here.
Then I was run this commands in powerShell with admin permission. Now i have my natural speed in wsl. Thank you!
PS. I use Windows 11

@Anutrix
Copy link

Anutrix commented Apr 2, 2023

I have max network speed in WSL2 but python -m venv venv-name is super slow.

@egeres
Copy link

egeres commented Apr 10, 2023

@Epskampie's answer worked for me!!

@MaximusR9
Copy link

I don't know if anyone else have this problem but I get decent speed in wsl (speedtest or git clone or git push) but when running a bash script the git clone and git push speed is very slow.

Git clone (running this cmd inside bash script): 450 kB/s
Git push (running this cmd inside bash script): doesn't go above 30 kB/s at all

I've tried disabling IPv6 and tried different wifi networks and even wired network but the upload speed while running bash script stays at 30 kB/s

@jlknauer
Copy link

Update:

I temporarily solved the slow upload speed in WSL by clean installing Windows. Returning to a clean build restored the upload speed to match that of the host (previously it was ~20x slower). I was on the March 14, 2023—KB5023706 (OS Build 22621.1413) Windows Build with all features working as expected.

However, last night Windows Update installed April 11, 2023—KB5025239 (OS Build 22621.1555), and my upload speeds have been cut by a factor of 10. Worse yet, when running the previously suggested commands to resolve issues for other users:

Disable-NetAdapterBinding -Name "vEthernet (WSL)" -ComponentID ms_tcpip6 -IncludeHidden # disable ipv6
Disable-NetAdapterLso -Name "vEthernet (WSL)" -IncludeHidden # Seems to disable the large packet. Didn't tested it since mine was already disabled

Get-NetAdapterBinding -IncludeHidden -Name "vEthernet (WSL)" # Check if ipv6 was disabled
Get-NetAdapterAdvancedProperty -IncludeHidden -Name "vEthernet (WSL)" # Check if large packet was disabled

my WSL now has no internet connectivity. Looking to see if removing the LCU will resolve my issue, but this is getting painful. Clearly Windows Updates are breaking WSL for users.

@flca267
Copy link

flca267 commented Apr 16, 2023

Update:

I temporarily solved the slow upload speed in WSL by clean installing Windows. Returning to a clean build restored the upload speed to match that of the host (previously it was ~20x slower). I was on the March 14, 2023—KB5023706 (OS Build 22621.1413) Windows Build with all features working as expected.

However, last night Windows Update installed April 11, 2023—KB5025239 (OS Build 22621.1555), and my upload speeds have been cut by a factor of 10. Worse yet, when running the previously suggested commands to resolve issues for other users:

Disable-NetAdapterBinding -Name "vEthernet (WSL)" -ComponentID ms_tcpip6 -IncludeHidden # disable ipv6
Disable-NetAdapterLso -Name "vEthernet (WSL)" -IncludeHidden # Seems to disable the large packet. Didn't tested it since mine was already disabled

Get-NetAdapterBinding -IncludeHidden -Name "vEthernet (WSL)" # Check if ipv6 was disabled
Get-NetAdapterAdvancedProperty -IncludeHidden -Name "vEthernet (WSL)" # Check if large packet was disabled

my WSL now has no internet connectivity. Looking to see if removing the LCU will resolve my issue, but this is getting painful. Clearly Windows Updates are breaking WSL for users.

I have the same problem and have no internet connectivity after I ran the commands above. Try to enable ipv6 & the large packet & reboot then the connectivity back . But the low speed problem is still not solved.

@pcgeek86
Copy link

Brand new install of Windows 11, and I'm getting 75-100 KB/sec while updating apt packages. This is beyond ridiculous.

image

@Anutrix
Copy link

Anutrix commented Apr 17, 2023

Brand new install of Windows 11, and I'm getting 75-100 KB/sec while updating apt packages. This is beyond ridiculous.

image

Instead of apt, try wget, curl or speed tests to test Internet speed in WSL. This ticket is for general network speed in WSL2, not just apt.

If the issue is only in apt for you, it could be the mirror issue. Try changing the mirror and check. Switching between https and http in source list is also a way to test for mirror issue. If all mirrors are slow and issue is only in apt, maybe you can create another ticket for it.

@prettydeep
Copy link

prettydeep commented Apr 17, 2023

Everything I've found tells me this is a bug with WSL2 using a Wi-Fi adapter. I've not had a problem with wired ethernet. The only thing that fixed the Wi-Fi for me was sharing the internet connection. However, it does not persist.

For those of you that found a fix using 'Internet Connection Sharing' but it does not persist across reboots, you can automate the fix when you spin up your WSL distro by adding the line below to your ~/.bashrc. Be sure to replace "Wi-Fi' with the name of your adapter (execute Get-NetAdapter in powershell).

# fix wi-fi connection sharing 
powershell.exe -Command netsh int ipv4 set interface "Wi-Fi" forwarding=enable > /dev/null 2>&1

@pcgeek86
Copy link

Brand new install of Windows 11, and I'm getting 75-100 KB/sec while updating apt packages. This is beyond ridiculous.
image

Instead of apt, try wget, curl or speed tests to test Internet speed in WSL. This ticket is for general network speed in WSL2, not just apt.

If the issue is only in apt for you, it could be the mirror issue. Try changing the mirror and check. Switching between https and http in source list is also a way to test for mirror issue. If all mirrors are slow and issue is only in apt, maybe you can create another ticket for it.

It's not just the apt package manager. I also installed Docker Engine, after enabling systemd, and I am experiencing incredibly slow speeds pulling a container image from Docker Hub.

I am using a 5Ghz TP-Link Wi-Fi adapter, going to a TP-Link EAP225 Access Point, across a high-speed Starlink satellite connection. I should be getting 100-250Mbps, just like I do on my host OS.

@daliendev
Copy link

daliendev commented Apr 22, 2023

same for me (with apt, git and so) here on windows 11 with WSL2 (debian distro but has same issue on ubuntu as well)
but what is very strange: I don't have this issue using a VPN tunnel, I'm also using some linux distro inside virtual boxes: don't have any network issue there...

As last comments mentioned this, I'm also using a usb tp-link wifi adapter
for now VPN is my simplest workaround when I need rapid network connection inside wsl on this computer

@MaximusR9
Copy link

Everything I've found tells me this is a bug with WSL2 using a Wi-Fi adapter. I've not had a problem with wired ethernet. The only thing that fixed the Wi-Fi for me was sharing the internet connection. However, it does not persist.

For those of you that found a fix using 'Internet Connection Sharing' but it does not persist across reboots, you can automate the fix when you spin up your WSL distro by adding the line below to your ~/.bashrc. Be sure to replace "Wi-Fi' with the name of your adapter (execute Get-NetAdapter in powershell).

# fix wi-fi connection sharing 
powershell.exe -Command netsh int ipv4 set interface "Wi-Fi" forwarding=enable > /dev/null 2>&1

I'm on wired connection and its still giving me terrible speeds

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