Using Windows Server 2022 as a hypervisor, I've created two Ubuntu VMs: an Ubuntu server and a desktop. The following is based on my experiences with the server on 22.04 and also 23.xx, although the desktop OS seems to work similar in that I'm experiencing the same issues.
For a reason I'm not yet aware of, Hyper-V and Ubuntu guests with SR-IOV enabled, create two network interfaces on the guest: one showing the vF (Broadcom), the other showing the Hyper-V driver.
lshw -C network
In Windows VMs with SR-IOV enabled, this does not happen. A single network adapter is created for the Broadcom interface. My only guess is that this has something to do with Hyper-V not knowing if the guest OS can support it so it creates a fallback adapter that will use the virtual switch.
However, my assumptions don't appear correct. I originally thought I could simply disable the Hyper-V network interface (eth0) in Ubuntu to force the OS to use the SR-IOV-enabled adapter.e.g. ip link set eth0 down
This unfortunately causes a complete loss of networking functionality. In fact, disabling that interface automatically disabled the other. Even if I manually set the Broadcom interface up, I can't ping anything.
However, if I disable the second interface enP33973s1
, SR-IOV is lost and traffic flows through the vSwitch.
I'm currently assigning both these adapters static IPs. I just don't quite understand what is actually happening here.
The other interesting thing about this setup is that if you tell Hyper-V to assign this VM's network card a static MAC address, then both interfaces created in Ubuntu use the same MAC. Perhaps this is why you can also enable "MAC address spoofing" for the VM? With the shared static MAC, I cannot use DHCP reservations for this VM.
Q: Why do I need two adapters for this to work in Ubuntu.
Q: Does it matter which IP I use for traffic? Say I want to set an A record in DNS, should it point to the enP339… interface IP? Both?
I'm tempted to claim that SR-IOV support for Ubuntu in Hyper-V is half-baked, but I guess I really just don't even understand how it works. Part of me wants to just completely switch back to using ESXi. Can anyone help clear up my confusion? Thank you in advance!