Hi,
since 2 Months I have no internet connectivity from my hyper-V VMs that use the Default Switch. On the same day also my WSL2 lost all internet connection (and never regained it). I think both problems are related because WSL2 uses a vSwitch with NAT under the hood just as a hyper V VM with the DefaultSwitch. As of now I disabled WSL to focus on just getting Hyper-V VMs to work. Let me describe the problems and all the troubleshooting i've done so far:
I disabled Hyper-V and WSL, rebooted and reenabled Hyper-V to start all fresh
I installed two totally fresh Ubuntu VMs one 20.04 one 18.04 (to check if it's an OS problem).
Both Ubuntu VMs have ufw disabled
I disabled Windows Defender on all network kinds and enabled Logging of dropped packets. The logs always remain empty.
The Host can ping the VMs
From neither VM I can ping the Host IP (the IP listed under the DefaultSwitch in ipconfig output) or any other IP Adress (e.g. 8.8.8.8).
I can however ping the other VM from either VM
from Ubuntu ip neighbour shows the HostIP is REACHABLE
tracepath HostIP shows no reply after first hop from either vm:
uli@18_04-VM:~$ tracepath 172.8.144.1
1?: [LOCALHOST] pmtu 1500
1: no reply
2: no reply
tracepath from Ubuntu 18.04 VM to 20.04 VM works
uli@18_04-VM:~$ tracepath 172.28.147.203
1?: [LOCALHOST] pmtu 1500
1: 172.28.147.203 0.420ms reached
1: 172.28.147.203 0.526ms reached
Resume: pmtu 1500 hops 1 back 1
tracepath from Ubuntu 20.04 VM to 18.04 VM show strange output. I could not find out what "???" means in that context. Maybe that problem is unreleated though.
uli@20_04-VM:~$ tracepath 172.28.157.110
1?: [LOCALHOST] pmtu 1500
1: ??? 0.325ms reached
1: ??? 0.371ms reached
Resume: pmtu 1500 hops 1 back 1
If I create an external vSwitch and bridge it with my Ethernet Adapter and plug that vSwitch into my VMs I get internet connectivity. Unfortunately that only works when my Laptop is connected via Ethernet. When I try to create an External vSwitch that is bridged with my Wifi Adapter an Error arises "Adding ports to the switch 'External' failed". Then my Host Network is totally broken, I need to reboot and delete the created bridge to fix it. I read somewhere that Hyper-V does not support all Wifi Adapters. I don't know if that makes sense but this just makes me want to solve the problem with the DefaultSwitch even more.
I used the easy fix program from https://docs.microsoft.com/en-us/troubleshoot/windows-client/virtualization/cannot-create-hyper-v-virtual-switch several times (I found that it deletes and recreates the DefaultSwitch) because my messing with the Switches totally broke my HostNetwork several times. Unfortunately it does not resolve the connectivity problem of the DefaultSwitch.
I checked the syslogs in both VMs and the only suspicous lines I saw was a message that indicated that a degraded feature set for DNS server. I think this is a different problem and probably unrelated, as I cannot ping ip addresses directly so DNS is not involved.
Nov 23 10:43:29 18_04-VM systemd-resolved[638]: Using degraded feature set (TCP) for DNS server 172.28.144.1.
Nov 23 10:44:17 18_04-VM systemd-resolved[638]: Using degraded feature set (UDP) for DNS server 172.28.144.1.
I checked the Host Windows EventLog but could not find any suspicous Error or Warning Events
Relevant outputs from Ubuntu 18.04 VM
uli@18_04-VM:~$ ip addr show
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:02:70:00 brd ff:ff:ff:ff:ff:ff
inet 172.28.157.110/20 brd 172.28.159.255 scope global dynamic noprefixroute eth0
valid_lft 82910sec preferred_lft 82910sec
inet6 fe80::16b4:42b1:139:7a3e/64 scope link noprefixroute
valid_lft forever preferred_lft forever
uli@18_04-VM:~$ ip neighbour show
172.28.147.203 dev eth0 lladdr 00:15:5d:02:70:01 STALE
172.28.144.1 dev eth0 lladdr 00:15:5d:83:89:cb REACHABLE
uli@uli-VM:~$ ip route
default via 172.28.144.1 dev eth0 proto dhcp metric 20100
169.254.0.0/16 dev eth0 scope link metric 1000
172.28.144.0/20 dev eth0 proto kernel scope link src 172.28.157.110 metric 100
uli@uli-VM:~$ ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2030ms
Host ipconfig output
PS C:\Users\uli> ipconfig
Windows IP Configuration
Ethernet adapter Ethernet:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter vEthernet (Default Switch):
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::f05e:a6e9:e82f:663c%44
IPv4 Address. . . . . . . . . . . : 172.28.144.1
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
Wireless LAN adapter Local Area Connection* 9:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::a547:9652:c867:4f50%5
IPv4 Address. . . . . . . . . . . : 192.168.2.112
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.2.1
Ethernet adapter Bluetooth Network Connection:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Host System Info: Windows 10 Professional Version 10.0.19041 Build 19041
Any Help or guide how to do further troubleshooting would be greatly appreciated. I think something is broken with how the DefaultSwitch uses my Host NAT. Anyhow I invested many many hours into finding the problem now and I could not get anywhere. It would be nice to avoid reinstalling windows as it would require a lot of hours to setup all my developer tools again.
Thanks