Score:1

Does WSL2 use native Linux TCP/IP stack?

va flag
R A

Let's say there's a bug in a Windows TCP/IP implementation. Would WSL2 be affected by it? Would WSL2 Ubuntu use native Linux kernel's TCP/IP stack?

Score:2
vn flag

Let's say there's a bug in a Windows TCP/IP implementation. Would WSL2 be affected by it?

Yes.

Does WSL2 use native Linux TCP/IP stack?

Also, yes.


The WSL2 network is using the native Linux TCP/IP implementation through the WSL2 kernel. That kernel is built from the upstream official Linux kernel, with relatively minor additions to optimize its performance and behavior in the WSL environment.

However, even though the native Linux stack is being used, the network interface is a virtual one, which connects to a virtual Hyper-V switch, which of course uses the Windows TCP/IP stack to connect to (usually) a physical NIC.

So by using Ubuntu on WSL2, you don't necessarily work around issues in the Windows networking implementation. Instead you actually have an additional point of failure:

  • Linux
  • Hyper-V
  • Windows

And I have seen an issue arise specifically in the Hyper-V implementation (from the WSL Github), although I don't recall exactly what it was at the moment.


Side-note: There's one possible scenario that I can think of in which Ubuntu would not use the Hyper-V/Windows virtual switches. If you used a USB NIC, you could expose it directly to Ubuntu via USB/IP. Oh wait ... ;-)

Ok, so while you are technically using the Windows IP stack in that scenario, you are not connecting to the external network using either Hyper-V or the Windows NIC.

Note that this likely requires you to build your own WSL2 kernel which would include support for the USB NIC. It's doubtful that the stock WSL2 comes with that support yet (release notes don't indicate it has been added), although it has been requested as a feature.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.