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

WSL2 second network adapter #10971

Closed
Mangosniper opened this issue Jan 2, 2024 · 4 comments
Closed

WSL2 second network adapter #10971

Mangosniper opened this issue Jan 2, 2024 · 4 comments

Comments

@Mangosniper
Copy link

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:

  • Checked if there is any config file in the WSL2 distribution (Ubuntu 20.04) where this needs to be configured. But I could not find any netplan config or similar
  • Checked if I can set it in the Hyper-V VM of WSL2 or the Virtual Switch or somewhere on Hyper-V via Powershell Commands. Did not find anything (Hyper-V WSL VM seems to be pretty inaccesiable in general)
  • Checked if it needs to be set via wsl.conf or .wslconfig. Did not find any setting for that and also on my old laptop there is no specific setting in those files that would explain that config
  • Checking any other Hyper-V config I could find or WSL config if it differs between both systems. Nothing...
  • Checked a lot of stackoverflow articles and similar but never find anyone who tells "This is how you add an additional network adapter in wsl2".

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

  • Ubuntu Running 2
    docker-desktop Stopped 2
    docker-desktop-data Stopped 2
    Ubuntu-22.04 Stopped 2

Content of .wslconfig

[wsl2]
memory=16GB


Content of wsl.conf

[network]
generateResolvConf = false

Copy link

github-actions bot commented Jan 2, 2024

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
Copy link
Author

Mangosniper commented Jan 5, 2024

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

  • I can see, that it goes via eth1 but the first hop is 192.168.178.1, despite beeing in a different subnet. Idk if something is routing between those two.
  • I checked the network interfaces from my old device in the WSL2 with lshw:

*-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

  • I was not able to find out anything from the MAC 02:50:00:00:00:01 or driver version, which differ from my eth0.
  • When having VPN enabled and trying to e.g. ping 1.1.1.1 I can see via cat /proc/net/dev that traffic is going via eth1

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

  • Looking at /sys/class/net I can see that eth1 is a virtual device

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/

  • hnsdiag list all under windows does also not show any hint about eth1

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/////////////////////

  • I played around with the infos from https://superuser.com/questions/1719857/how-to-find-out-wsl2-version to check if it makes a difference if I use the inbox or store version of the WSL. But it does not seem so.
  • The structure of the registry keys on my old device and my new device is different though. No Idea if that is of any relevance

Old device:

image

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

image

  • I stumbled upon https://randombytes.substack.com/p/bridged-networking-under-wsl and also the mirrored networkingMode. However, as I run Win 10 they are of no use for me.
  • Whats funny is: When I remove the WSL from Windows Features and all installed Distributions and also uninstall Docker for Desktop, then reinstall the WSL again, I DO see some more network interfaces in the WSL2. Like bond0 dummy0 tunl0. Basically the ones from my original posting. But not eth1. As soon as I install Docker for Desktop AND select the WSL2 option, those adapters vanish and its lo and eth0. Nothing more.

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
Copy link
Collaborator

OneBlue commented Jan 9, 2024

@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
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants