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

Questions: implementation of WSL 2 networking #4346

Closed
cerebrate opened this issue Jul 28, 2019 · 1 comment
Closed

Questions: implementation of WSL 2 networking #4346

cerebrate opened this issue Jul 28, 2019 · 1 comment
Labels

Comments

@cerebrate
Copy link

  • Your Windows build number: 18945

This is more of a series of questions/discussion items than an issue - some of which may well relate to Hyper-V and network namespaces, per #4304 - but a few things have occurred to me to ask after assorted fiddling done in the wake of my network issues ( #4342 ). The whole of the thing, really, is a request for a quick outline of how networking's implemented in WSL 2, but these are some specific questions I had:

  • How does the WSL 2 interface get its IP address? It's not configured statically Linux-side, and it doesn't appear to be using DHCP, so where does that come from?
  • Could it be made to use DHCP (which also I suppose is the "why doesn't it?" question? In my flailing around with [WSL 2] No network connectivity after upgrade to 18945 #4342 I observed that a DHCP client inside WSL 2 is perfectly capable of picking up an address, etc., if the WSL virtual switch is bridged to the external network, so it seemed a little odd that it wasn't)?

(I don't have a particular need for this ATM, but I note that in this brave new systemd world, mDNS support, et. al., is build into systemd-resolved rather than using avahi-daemon and can't be turned on except on interfaces configured by systemd-networkd, which so far as I can tell can either entirely ignore the WSL 2 eth0, or else can break it by not being able to get a DHCP IP. It can't set some settings and leave others alone.)

  • I'm curious as to the reasoning behind WSL 2 using a NATted network rather than just bridging to the existing external network; would appreciate any insight. Is it just as a step towards unifying the IP addresses with the Windows host?
  • Are there any current major barriers to IPv6 support? That's something that I couldn't get to come up even with a bridged network, which seemed curious, as I have seen it work in Hyper-V VMs before now.

Thanks in advance.

@Biswa96
Copy link

Biswa96 commented Jul 28, 2019

The network uses some kind of DHCP. First the Windows/Hyper-V side NIC is created with a random IPv4 address and configuration (subnet, guest IPv4, DNS, gateway). WSL side IP address is automatically added in that configuration. If WSL (aka. guest/container) is terminated the Windows side NIC remains but WSL side IPv4 address is automatically picked up from previous subnet. More network information can be found in LxssManager.dll and computenetwork.dll.

@craigloewen-msft craigloewen-msft added network wsl2 Issue/feature applies to WSL 2 labels Aug 6, 2019
@therealkenc therealkenc added question and removed network wsl2 Issue/feature applies to WSL 2 labels May 27, 2020
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

4 participants