How to Configure Hyper-V Network Adapter Failover IP Settings in Windows 11 Using PowerShell

In enterprise disaster recovery architectures and multi-site staging environments using Hyper-V Replica, virtual machines are continuously replicated from a primary host to a secondary recovery host. While data blocks and disk states mirror accurately, network environments at disaster recovery sites typically operate on different IP subnets, routing domains, and DNS servers. If a replica virtual machine uses static IP addressing configured within its guest operating system, bringing it online at the secondary recovery site results in immediate network isolation because its primary IP address does not match the secondary site’s default gateway and subnet mask.

Hyper-V solves this challenge through automated Network Adapter Failover Configuration via Hyper-V Integration Services (specifically the Data Exchange Service / KVP). Through PowerShell, administrators can use Set-VMNetworkAdapterFailoverConfiguration and Get-VMNetworkAdapterFailoverConfiguration to pre-inject alternate static IPv4 and IPv6 configurations into the replica virtual machine, ensuring seamless network re-configuration upon disaster recovery failover.

Understanding Hyper-V Replica Network Injection Architecture

The Hyper-V network failover mechanism bridges the hypervisor host management layer with the guest operating system kernel:

  • Key-Value Pair (KVP) Exchange: The hypervisor writes alternate network settings into guest registry entries via the Hyper-V Data Exchange Service. The guest operating system reads these parameters without requiring an interactive administrative login or external network connectivity.
  • Automated Guest Adaptation: During normal replication, the replica VM remains powered off. When an administrator initiates a planned or unplanned failover (via Start-VMFailover), Hyper-V injects the pre-configured failover IP parameters directly into the guest network stack as the VM powers up.
  • Multi-Adapter Support: Complex multi-homed virtual machines with multiple virtual network interfaces can have distinct failover IP, subnet, gateway, and DNS configurations mapped per adapter.

Prerequisites and Hyper-V Integration Services Verification

Configuring failover IP injection requires local administrative privileges, Hyper-V PowerShell cmdlets on Windows 11, and active Hyper-V Integration Services within the target virtual machine.

Open an elevated PowerShell console and verify module availability:

# Check Hyper-V PowerShell module
Get-Module -ListAvailable -Name Hyper-V

# Query target virtual machine operational state
Get-VM -Name "AppServer-Replica" | Select-Object Name, State, ReplicationState

Ensure that the Data Exchange integration service is enabled on the virtual machine:

# Verify Data Exchange integration service is active
Get-VMIntegrationService -VMName "AppServer-Replica" -Name "Key-Value Pair Exchange"

If the service is disabled, enable it immediately:

# Enable Key-Value Pair Exchange for network injection
Enable-VMIntegrationService -VMName "AppServer-Replica" -Name "Key-Value Pair Exchange"

Inspecting Current Failover Network Configuration

Before applying new failover IP settings, query the virtual machine’s existing failover configuration:

# Retrieve current failover network adapter parameters
Get-VMNetworkAdapter -VMName "AppServer-Replica" | Get-VMNetworkAdapterFailoverConfiguration

If unconfigured, the output will display empty fields for IPv4 and IPv6 failover parameters, meaning the replica VM will retain its primary production IP settings upon failover.

Configuring Static IPv4 Failover Settings

To configure static IPv4 failover parameters matching the disaster recovery site’s network topology (for example, switching from production 192.168.10.0/24 to disaster recovery 10.20.10.0/24):

# Retrieve the specific virtual network adapter
$NIC = Get-VMNetworkAdapter -VMName "AppServer-Replica" -Name "Network Adapter"

# Configure static IPv4 failover parameters
Set-VMNetworkAdapterFailoverConfiguration -VMNetworkAdapter $NIC `
                                         -IPv4Address "10.20.10.55" `
                                         -IPv4SubnetMask "255.255.255.0" `
                                         -IPv4DefaultGateway "10.20.10.1" `
                                         -IPv4PreferredDNSServer "10.20.10.10" `
                                         -IPv4AlternateDNSServer "10.20.10.11"

These settings are committed to the hypervisor’s configuration store. The replica VM does not need to be running for these parameters to be saved.

Configuring Dual-Stack IPv4 and IPv6 Failover Settings

For modern enterprise networks operating dual-stack environments, supply both IPv4 and IPv6 parameters in a single configuration cmdlet:

# Configure dual-stack IPv4 and IPv6 failover addressing
Set-VMNetworkAdapterFailoverConfiguration -VMNetworkAdapter $NIC `
                                         -IPv4Address "10.20.10.55" `
                                         -IPv4SubnetMask "255.255.255.0" `
                                         -IPv4DefaultGateway "10.20.10.1" `
                                         -IPv4PreferredDNSServer "10.20.10.10" `
                                         -IPv6Address "2001:db8:cafe:10::55" `
                                         -IPv6SubnetPrefixLength 64 `
                                         -IPv6DefaultGateway "2001:db8:cafe:10::1" `
                                         -IPv6PreferredDNSServer "2001:db8:cafe:10::10"

Validating Failover Network Parameters

Verify that all failover parameters have been committed cleanly to the virtual network adapter:

# Validate updated failover network configuration
Get-VMNetworkAdapter -VMName "AppServer-Replica" | `
    Get-VMNetworkAdapterFailoverConfiguration | Format-List

The console output confirms the injected IP addresses, subnets, default gateways, and DNS server addresses.

Testing Failover Network Injection with Test-Failover

Hyper-V Replica allows non-disruptive disaster recovery testing using Test Failover without impacting ongoing replication:

# Initiate a test failover to a private isolated switch
Start-VMFailover -VMName "AppServer-Replica" -AsTest

# Verify that the temporary test VM boots with the injected failover IP
Get-VM -Name "AppServer-Replica - Test" | Start-VM

Once verified, clean up the test container:

# Stop and terminate test failover instance
Stop-VMFailover -VMName "AppServer-Replica" -AsTest

By defining failover IP parameters using Set-VMNetworkAdapterFailoverConfiguration, IT administrators eliminate manual re-IP procedures, ensuring virtual machines achieve immediate network connectivity upon disaster recovery failover.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.