microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.25k stars 812 forks source link

WSL2 second network adapter #10971

Closed Mangosniper closed 8 months ago

Mangosniper commented 8 months ago

Summary: I have wsl2 running on my current laptop and need to switch devices. Therefore I am trying to setup wsl on the replacement device the same way, however, I seem to have something configured I cant figure out how to configure anymore.

I especially had problems using the wsl2 when also using a VPN that creates a lot of routes in windows. I got it solved similar to what is described at https://gist.github.com/machuu/7663aa653828d81efbc2aaad6e3b1431

However, on my new system I can not reach anything anymore when the VPN is active. E.g. I try to ping 1.1.1.1. -> Timeout. As soon as I disable the VPN it works again.

When looking on my old laptop and doing ip a in the wsl I get:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether da:37:c1:c8:e6:85 brd ff:ff:ff:ff:ff:ff 3: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 9e:cf:a3:2f:4e:9d brd ff:ff:ff:ff:ff:ff 4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:15:5d:b7:3e:ff brd ff:ff:ff:ff:ff:ff inet 172.23.62.87/20 brd 172.23.63.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::215:5dff:feb7:3eff/64 scope link valid_lft forever preferred_lft forever 5: tunl0@NONE: mtu 1480 qdisc noop state DOWN group default qlen 1000 link/ipip 0.0.0.0 brd 0.0.0.0 6: sit0@NONE: mtu 1480 qdisc noop state DOWN group default qlen 1000 link/sit 0.0.0.0 brd 0.0.0.0 7: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000 link/ether 02:50:00:00:00:01 brd ff:ff:ff:ff:ff:ff inet 192.168.67.3/24 scope global eth1 valid_lft forever preferred_lft forever inet6 fe80::847c:e0ff:fea9:b0cc/64 scope link valid_lft forever preferred_lft forever

When I do this on my new device I get only

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:15:5d:45:50:c0 brd ff:ff:ff:ff:ff:ff inet 172.29.115.235/20 brd 172.29.127.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::215:5dff:fe45:50c0/64 scope link valid_lft forever preferred_lft forever

The eth1 is missing. Why is that important? If I do ifconfig eth1 down on the old laptop, pinging 1.1.1.1 also stops working.

My main Problem: I can not remember how I added the eth1 interface to my WSL2. I did a lot of research:

I found https://github.com/dantmnf/WSLAttachSwitch but i am to 99.9% sure I havent used any thirdparty software to configure anything for or in my WSL. Also this tool is for attaching multiple hyper-v switches and I dont have any additional ones.

I also found some discussions where people seem to have multiple ethernet adapter in the WSL2, but never it gets explained how this was achieved:

I would appreciate any help or hints. Below, you can find some more infos about my config (Of the old system, where it is currently working. But I dont see anything that would explain why I have eth0 and eth1 and not only eth0 as in my new system) I am quite frustrated since I KNOW it can work, as I have a working system but I DONT KNOW how I configured it in the first place...


PS C:\Windows\system32> get-vmswitch | select *

DefaultQueueVmmqQueuePairs : 0 DefaultQueueVmmqQueuePairsRequested : 16 Name : Default Switch Id : c08cb7b8-9b3c-408e-8e30-5e16a3aeb444 Notes : Extensions : {Microsoft Windows-Filterplattform, Microsoft Azure VFP Switch Extension, Microsoft-NDIS-Aufzeichnung} BandwidthReservationMode : Absolute PacketDirectEnabled : False EmbeddedTeamingEnabled : False IovEnabled : False SwitchType : Internal AllowManagementOS : True NetAdapterInterfaceDescription : NetAdapterInterfaceDescriptions : NetAdapterInterfaceGuid : IovSupport : False IovSupportReasons : AvailableIPSecSA : 0 NumberIPSecSAAllocated : 0 AvailableVMQueues : 0 NumberVmqAllocated : 0 IovQueuePairCount : 0 IovQueuePairsInUse : 0 IovVirtualFunctionCount : 0 IovVirtualFunctionsInUse : 0 PacketDirectInUse : False DefaultQueueVrssEnabledRequested : True DefaultQueueVrssEnabled : False DefaultQueueVmmqEnabledRequested : True DefaultQueueVmmqEnabled : False DefaultQueueVrssMaxQueuePairsRequested : 16 DefaultQueueVrssMaxQueuePairs : 0 DefaultQueueVrssMinQueuePairsRequested : 1 DefaultQueueVrssMinQueuePairs : 0 DefaultQueueVrssQueueSchedulingModeRequested : StaticVrss DefaultQueueVrssQueueSchedulingMode : Dynamic DefaultQueueVrssExcludePrimaryProcessorRequested : False DefaultQueueVrssExcludePrimaryProcessor : False SoftwareRscEnabled : False BandwidthPercentage : 0 DefaultFlowMinimumBandwidthAbsolute : 0 DefaultFlowMinimumBandwidthWeight : 0 CimSession : CimSession: . ComputerName : COM100491 IsDeleted : False

DefaultQueueVmmqQueuePairs : 0 DefaultQueueVmmqQueuePairsRequested : 16 Name : WSL Id : 7b976bed-06b6-4a08-bc35-817deda90c37 Notes : Extensions : {Microsoft Windows-Filterplattform, Microsoft Azure VFP Switch Extension, Microsoft-NDIS-Aufzeichnung} BandwidthReservationMode : Absolute PacketDirectEnabled : False EmbeddedTeamingEnabled : False IovEnabled : False SwitchType : Internal AllowManagementOS : True NetAdapterInterfaceDescription : NetAdapterInterfaceDescriptions : NetAdapterInterfaceGuid : IovSupport : False IovSupportReasons : AvailableIPSecSA : 0 NumberIPSecSAAllocated : 0 AvailableVMQueues : 0 NumberVmqAllocated : 0 IovQueuePairCount : 0 IovQueuePairsInUse : 0 IovVirtualFunctionCount : 0 IovVirtualFunctionsInUse : 0 PacketDirectInUse : False DefaultQueueVrssEnabledRequested : True DefaultQueueVrssEnabled : False DefaultQueueVmmqEnabledRequested : True DefaultQueueVmmqEnabled : False DefaultQueueVrssMaxQueuePairsRequested : 16 DefaultQueueVrssMaxQueuePairs : 0 DefaultQueueVrssMinQueuePairsRequested : 1 DefaultQueueVrssMinQueuePairs : 0 DefaultQueueVrssQueueSchedulingModeRequested : StaticVrss DefaultQueueVrssQueueSchedulingMode : Dynamic DefaultQueueVrssExcludePrimaryProcessorRequested : False DefaultQueueVrssExcludePrimaryProcessor : False SoftwareRscEnabled : False BandwidthPercentage : 0 DefaultFlowMinimumBandwidthAbsolute : 0 DefaultFlowMinimumBandwidthWeight : 0 CimSession : CimSession: . ComputerName : COM100491 IsDeleted : False


PS C:\Windows\system32> hcsdiag list 51E4F2E7-6C85-4F47-A9C2-B8EA261CD24B VM, Running, 51E4F2E7-6C85-4F47-A9C2-B8EA261CD24B, WSL


PS C:\Windows\system32> wsl --list -v NAME STATE VERSION


Content of .wslconfig

[wsl2] memory=16GB


Content of wsl.conf

[network] generateResolvConf = false

github-actions[bot] commented 8 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

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. Thank you!

Open similar issues:

Closed similar issues:

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

Mangosniper commented 8 months ago

I did some more research and investigation, but havent found a real proper solution to my issue yet. It is still unknown to me why on once device I have additional ethernet adapters, especially the eth1 adatper that allows me to still be able to connect to services in the www aswell as the ones behind the VPN. I did make some findings on the way though:

root@com100491:~# ip route get 1.1.1.1 1.1.1.1 via 192.168.67.1 dev eth1 src 192.168.67.3 uid 0 cache root@com100491:~# traceroute -I -w 1 1.1.1.1 traceroute to 1.1.1.1 (1.1.1.1), 64 hops max 1 192.168.178.1 4.728ms 3.993ms 3.538ms

-network:0 DISABLED description: Ethernet interface physical id: 1 logical name: bond0 serial: 66:b1:16:cc:39:42 capabilities: ethernet physical configuration: autonegotiation=off broadcast=yes driver=bonding driverversion=5.10.102.1-microsoft-standard-W firmware=2 link=no master=yes multicast=yes -network:1 DISABLED description: Ethernet interface physical id: 2 logical name: dummy0 serial: c6:d1:20:3f:7f:8a capabilities: ethernet physical configuration: broadcast=yes driver=dummy driverversion=5.10.102.1-microsoft-standard-W -network:2 description: Ethernet interface physical id: 3 logical name: eth0 serial: 00:15:5d:b7:37:60 size: 10Gbit/s capabilities: ethernet physical configuration: autonegotiation=off broadcast=yes driver=hv_netvsc driverversion=5.10.102.1-microsoft-standard-W duplex=full firmware=N/A ip=172.23.50.159 link=yes multicast=yes speed=10Gbit/s -network:3 description: Ethernet interface physical id: 4 logical name: eth1 serial: 02:50:00:00:00:01 size: 10Mbit/s capabilities: ethernet physical configuration: autonegotiation=off broadcast=yes driver=tun driverversion=1.6 duplex=full ip=192.168.67.3 link=yes > multicast=yes port=twisted pair speed=10Mbit/s

root@com100491:~# cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 7993 100 0 0 0 0 0 0 7993 100 0 0 0 0 0 0 bond0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dummy0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 eth0: 4090613 27957 0 0 0 0 0 27957 1496 20 0 0 0 0 0 0 tunl0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 eth1: 420862 1233 0 0 0 0 0 0 445290 1289 0 0 0 0 0 0

root@com100491:/sys/class/net# ll total 0 drwxr-xr-x 2 root root 0 Jan 5 08:37 ./ drwxr-xr-x 31 root root 0 Jan 5 08:37 ../ lrwxrwxrwx 1 root root 0 Jan 5 14:40 bond0 -> ../../devices/virtual/net/bond0/ -rw-r--r-- 1 root root 4096 Jan 5 14:40 bonding_masters lrwxrwxrwx 1 root root 0 Jan 5 14:40 dummy0 -> ../../devices/virtual/net/dummy0/ lrwxrwxrwx 1 root root 0 Jan 5 14:40 eth0 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/VMBUS:00/cc21ada4-7b82-48df-baab-234045ff4025/net/eth0/ lrwxrwxrwx 1 root root 0 Jan 5 08:37 eth1 -> ../../devices/virtual/net/eth1/ lrwxrwxrwx 1 root root 0 Jan 5 14:40 lo -> ../../devices/virtual/net/lo/ lrwxrwxrwx 1 root root 0 Jan 5 14:40 sit0 -> ../../devices/virtual/net/sit0/ lrwxrwxrwx 1 root root 0 Jan 5 14:40 tunl0 -> ../../devices/virtual/net/tunl0/

PS C:\Windows\system32> hnsdiag list all ////////////////////////NETWORKS///////////////////////

Network : C08CB7B8-9B3C-408E-8E30-5E16A3AEB444 Name : Default Switch Type : ICS Subnet Address : 172.26.48.0/20 Gateway : 172.26.48.1

Network : B95D0C5E-57D4-412B-B571-18A81A16E005 Name : WSL Type : ICS Subnet Address : 172.23.48.0/20 Gateway : 172.23.48.1

///////////////////////ENDPOINTS///////////////////////

Endpoint : 01898dcf-961b-4617-87db-be5229505790 Name : Ethernet IP Address : 172.23.56.174

//////////////////////NAMESPACES///////////////////////

Namespace : 910f7d92-ba2d-4c3f-98ae-7c0ac590d2dc

/////////////////////LOADBALANCERS/////////////////////

Old device:

image

New device (Note: I changed the IP-Range via https://github.com/wikiped/WSL-IpHandler):

image

I set my distribution version now to WSL1, despite remembering that I got other problems with that in the past. However, due to the fact that WSL1 distries use the same adapters than the host, I dont have any connectivity problems while having the VPN enabled then.

Still, if someone has any explenation why the hell it works on my old device and how I got the eth1 adapter: Highly appreciated.

OneBlue commented 8 months ago

@Mangosniper: Unfortunately mirrored networking would be your best bet for this scenario (although as you said it's only available on Windows 11).

Closing since this issue should be solved by upgrading Windows & enabling Mirrored Networking

MakoWish commented 1 month ago

@Mangosniper: Unfortunately mirrored networking would be your best bet for this scenario (although as you said it's only available on Windows 11).

Closing since this issue should be solved by upgrading Windows & enabling Mirrored Networking

Not everybody CAN upgrade to Windows 11. My computer does not have TPM2.0, so I cannot upgrade.