Windows 2025
Sponsored Link

Hyper-V : Integration Services (Linux)2024/12/13

 

These are Integration Services settings that improve integration between the Hyper-V host and Linux guest systems.

[1] By default, all settings on the Hyper-V host are enabled except for the Guest Services Interface.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# integration services on Hyper-V Host
PS C:\Users\Administrator> Get-VMIntegrationService -VMName "Ubuntu 24.04" 

VMName       Name                    Enabled PrimaryStatusDescription SecondaryStatusDescription
------       ----                    ------- ------------------------ --------------------------
Ubuntu 24.04 Guest Service Interface False   OK
Ubuntu 24.04 Heartbeat               True    OK
Ubuntu 24.04 Key-Value Pair Exchange True    OK                       The protocol version of the component installed in the...
Ubuntu 24.04 Shutdown                True    OK
Ubuntu 24.04 Time Synchronization    True    OK
Ubuntu 24.04 VSS                     True    OK                       The protocol version of the component installed in the...
[2] On the Linux guest side, in major distributions, the screen and keyboard drivers are loaded as kernel modules by default, but in order to obtain information such as the guest's IP address from the host side or to take snapshots, you need to install additional packages on the Linux guest side.
root@ubuntu:~# lsmod | grep hv_ 
hv_balloon             45056  0
hv_storvsc             24576  2
hv_netvsc             118784  0
scsi_transport_fc     114688  1 hv_storvsc
hv_utils               53248  0
hv_vmbus              176128  8 hv_balloon,hv_utils,hv_netvsc,hid_hyperv,hv_storvsc,hyperv_keyboard,hyperv_drm,hyperv_fb


# install packages and start services as necessary
# - hypervkvpd : send guest system information, such as IP address, to the host
# - hypervvssd : snapshots and backups can be taken from the host

# RedHat series
[root@rhel ~]# dnf -y install hyperv-daemons 
[root@rhel ~]# systemctl start hypervkvpd hypervvssd 

# Debian
root@debian:~# apt -y install hyperv-daemons 
root@debian:~# systemctl start hv-kvp-daemon hv-vss-daemon 

# Ubuntu
root@ubuntu:~# apt -y install linux-cloud-tools-$(uname -r) 
root@ubuntu:~# systemctl start hv-kvp-daemon hv-vss-daemon 
[3] If you enable the KVP service or VSS service on the Linux guest, you will be able to check information such as the IP address from the Hyper-V host.
PS C:\Users\Administrator> Get-VM 

Name         State   CPUUsage(%) MemoryAssigned(M) Uptime           Status             Version
----         -----   ----------- ----------------- ------           ------             -------
CentOS 9     Running 0           4096              00:37:32.6540000 Operating normally 12.0
Ubuntu 24.04 Running 0           4096              00:06:19.8610000 Operating normally 12.0


PS C:\Users\Administrator> Get-VMNetworkAdapter -VMName "CentOS 9" | Select IPAddresses 

IPAddresses
-----------
{10.0.0.221, fe80::215:5dff:fe00:6602}

PS C:\Users\Administrator> Get-VMNetworkAdapter -VMName "Ubuntu 24.04" | Select-Object * 

VMCheckpointId                          : 00000000-0000-0000-0000-000000000000
VMCheckpointName                        :
VmmqQueuePairs                          : 8
VmmqQueuePairsRequested                 : 16
ClusterMonitored                        : True
MacAddress                              : 00155D006601
MediaType                               : 0
DynamicMacAddressEnabled                : True
InterruptModeration                     : True
AllowPacketDirect                       : False
VirtualSystemIdentifiers                : {1db50410-0987-44e2-b1c3-53947e99e5c8, b72d2e6e-27b5-41c9-8b98-a32207bfa9cb}
NumaAwarePlacement                      : False
IsLegacy                                : False
IsSynthetic                             : True
IPAddresses                             : {10.0.0.233, fe80::215:5dff:fe00:6601}
DeviceNaming                            : Off
IovWeight                               : 0
IovQueuePairsRequested                  : 1
IovInterruptModeration                  : Default
PacketDirectNumProcs                    : 0
PacketDirectModerationCount             : 64
PacketDirectModerationInterval          : 1000000
IovQueuePairsAssigned                   : 0
IovUsage                                : 0
VirtualFunction                         :
MandatoryFeatureId                      : {}
MandatoryFeatureName                    : {}
PoolName                                :
Connected                               : True
SwitchName                              : Red Hat VirtIO Ethernet Adapter - Virtual Switch
AdapterId                               : F2967DAC-68A0-47DB-8D7A-8F96201843CA
TestReplicaPoolName                     :
TestReplicaSwitchName                   :
StatusDescription                       : {OK}
Status                                  : {Ok}
IsManagementOs                          : False
IsExternalAdapter                       : False
Id                                      : Microsoft:089529DA-6A06-4627-AA5E-E66F6BD6E28E\F2967DAC-68A0-47DB-8D7A-8F96201843CA
SwitchId                                : 0291c0bc-7e81-4d90-a039-21d2a92cdb6b
AclList                                 : {}
ExtendedAclList                         : {}
IsolationSetting                        : VMNetworkAdapterIsolationSetting
RoutingDomainList                       : {}
VlanSetting                             : VMNetworkAdapterVlanSetting
BandwidthSetting                        :
CurrentIsolationMode                    : Vlan
MacAddressSpoofing                      : Off
DhcpGuard                               : Off
RouterGuard                             : Off
PortMirroringMode                       : None
IeeePriorityTag                         : Off
VirtualSubnetId                         : 0
DynamicIPAddressLimit                   : 0
StormLimit                              : 0
AllowTeaming                            : Off
FixSpeed10G                             : Off
VMQWeight                               : 100
IPsecOffloadMaxSA                       : 512
VrssEnabled                             : True
VrssEnabledRequested                    : True
VmmqEnabled                             : False
VmmqEnabledRequested                    : True
VrssMaxQueuePairs                       : 8
VrssMaxQueuePairsRequested              : 16
VrssMinQueuePairs                       : 1
VrssMinQueuePairsRequested              : 1
VrssQueueSchedulingMode                 : Dynamic
VrssQueueSchedulingModeRequested        : Dynamic
VrssExcludePrimaryProcessor             : False
VrssExcludePrimaryProcessorRequested    : False
VrssIndependentHostSpreading            : False
VrssIndependentHostSpreadingRequested   : False
VrssVmbusChannelAffinityPolicy          : Strong
VrssVmbusChannelAffinityPolicyRequested : Strong
RscEnabled                              : True
RscEnabledRequested                     : True
VmqUsage                                : 0
IPsecOffloadSAUsage                     : 0
VFDataPathActive                        : False
VMQueue                                 :
BandwidthPercentage                     : 0
IsTemplate                              : False
Name                                    : Network Adapter
VMId                                    : 089529da-6a06-4627-aa5e-e66f6bd6e28e
VMName                                  : Ubuntu 24.04
VMSnapshotId                            : 00000000-0000-0000-0000-000000000000
VMSnapshotName                          :
CimSession                              : CimSession: .
ComputerName                            : RX-8
IsDeleted                               : False
[4] If you enable [Guest Services Interface] on the Hyper-V host and start the file copy service on the guest, you will be able to copy files between the host and guest.
# on Hyper-V host side
PS C:\Users\Administrator> Enable-VMIntegrationService -VMName "Ubuntu 24.04" -Name "Guest Service Interface" 
PS C:\Users\Administrator> Get-VMIntegrationService -VMName "Ubuntu 24.04" 

VMName       Name                    Enabled PrimaryStatusDescription SecondaryStatusDescription
------       ----                    ------- ------------------------ --------------------------
Ubuntu 24.04 Guest Service Interface True    OK
Ubuntu 24.04 Heartbeat               True    OK
Ubuntu 24.04 Key-Value Pair Exchange True    OK                       The protocol version of the component installed in the...
Ubuntu 24.04 Shutdown                True    OK
Ubuntu 24.04 Time Synchronization    True    OK
Ubuntu 24.04 VSS                     True    OK                       The protocol version of the component installed in the...


# on guest side
# RedHat series
[root@rhel ~]# dnf -y install hyperv-daemons 
[root@rhel ~]# systemctl start hypervfcopyd 

# Debian
root@debian:~# apt -y install hyperv-daemons 
root@debian:~# systemctl start hv-fcopy-daemon 

# Ubuntu
root@ubuntu:~# apt -y install linux-cloud-tools-$(uname -r) 
root@ubuntu:~# systemctl start hv-fcopy-daemon 


# verify file copy on Hyper-V host
PS C:\Users\Administrator> Add-Content testfile.txt "file copy test" 
PS C:\Users\Administrator> Copy-VMFile "Ubuntu 24.04" -SourcePath "C:\Users\Administrator\testfile.txt" -DestinationPath "/tmp" -FileSource Host 

PS C:\Users\Administrator> Get-VMNetworkAdapter -VMName "Ubuntu 24.04" | Select IPAddresses 

IPAddresses
-----------
{10.0.0.233, fe80::215:5dff:fe00:6601}

PS C:\Users\Administrator> ssh ubuntu@10.0.0.233 "cat /tmp/testfile.txt" 
ubuntu@10.0.0.233's password:
file copy test
Matched Content