powersj / whatsthis

Am I on a cloud, in a container, virtualized, or plain bare metal?

Home Page:https://powersj.github.io/whatsthis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WSL network devices missing names

powersj opened this issue · comments

Under WSL 1.0 these nework adapters:

$ ls -l /sys/class/net
total 0
lrwxrwxrwx 1 root root 0 Dec 27 21:03 eth0 -> ../../devices/virtual/net/eth0
lrwxrwxrwx 1 root root 0 Dec 27 21:03 eth1 -> ../../devices/virtual/net/eth1
lrwxrwxrwx 1 root root 0 Dec 27 21:03 eth2 -> ../../devices/virtual/net/eth2
lrwxrwxrwx 1 root root 0 Dec 27 21:03 eth3 -> ../../devices/virtual/net/eth3
lrwxrwxrwx 1 root root 0 Dec 27 21:03 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx 1 root root 0 Dec 27 21:03 wifi0 -> ../../devices/virtual/net/wifi0
lrwxrwxrwx 1 root root 0 Dec 27 21:03 wifi1 -> ../../devices/virtual/net/wifi1
lrwxrwxrwx 1 root root 0 Dec 27 21:03 wifi2 -> ../../devices/virtual/net/wifi2

Produces the following output:

$ ./whatsthis network
network:
- virtual:
  -  24:4b:fe:9a:a4:fa mtu 1500
  -  a4:b1:c1:36:bb:8f mtu 1500
  -  00:15:5d:92:83:43 mtu 1500
  -  00:15:5d:fc:ff:e1 mtu 1500
  -  a4:b1:c1:36:bb:8b mtu 1500
  -  a4:b1:c1:36:bb:8c mtu 1500
  -  a6:b1:c1:36:bb:8b mtu 1500

Under WSL 2.0 there is an extra line due to the bonding_masters file:

$ ls -l /sys/class/net
total 0
lrwxrwxrwx 1 root root    0 Dec 27 21:06 bond0 -> ../../devices/virtual/net/bond0
-rw-r--r-- 1 root root 4096 Dec 27 21:06 bonding_masters
lrwxrwxrwx 1 root root    0 Dec 27 21:06 dummy0 -> ../../devices/virtual/net/dummy0
lrwxrwxrwx 1 root root    0 Dec 27 21:06 eth0 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/VMBUS:00/fc785225-9131-5661-ac0c-3a157c61ae15/net/eth0
lrwxrwxrwx 1 root root    0 Dec 27 21:06 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx 1 root root    0 Dec 27 21:06 sit0 -> ../../devices/virtual/net/sit0

Produces the following output:

network:
- physical:
  -   -1 mtu -1 ()
  - eth0 00:15:5d:b8:ae:77 10000 mtu 1500 (hv_netvsc)
- virtual:
  - bond0 fe:33:62:fd:f1:79 mtu 1500
  - dummy0 5a:f7:0f:88:26:7e mtu 1500
  - sit0 00:00:00:00 mtu 1480