Skip to content

Commit e2a38cb

Browse files
Merge pull request #17629 from sipastak/al-migrate-static-ip
Migrate static IP for Linux VMs
2 parents 19207a1 + b6098fe commit e2a38cb

File tree

3 files changed

+150
-36
lines changed

3 files changed

+150
-36
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
author: sipastak
3+
ms.author: sipastak
4+
ms.service: azure-local
5+
ms.topic: include
6+
ms.date: 04/14/2025
7+
ms.reviewer: sipastak
8+
---
9+
10+
### Prepare target Azure Local instance and logical network
11+
12+
On the target Azure Local instance, provision a static Azure Arc logical network to support the migration. This setup requires defining the following:
13+
14+
- IP address space
15+
- Gateway address
16+
- DNS servers
17+
- an IP pool range (optional)
18+
19+
For detailed guidance on creating and configuring static or dynamic Azure Arc logical networks, see [Create logical networks for Azure Local](../manage/create-logical-networks.md?tabs=azurecli).
20+
21+
Ensure that the static IP addresses you plan to migrate are available in the static logical network and not assigned to another VM. If an IP address is already in use, the migration fails with the error: **The address is already in use.** To avoid this:
22+
23+
1. Go to the target static logical network.
24+
1. Check which IP addresses are in use.
25+
1. Remove any NICs assigned to the static IPs you want to migrate.
26+
27+
:::image type="content" source="../migrate/media/migrate-maintain-ip-addresses/connected-devices.png" alt-text="Screenshot of Connected Devices page.":::
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
author: sipastak
3+
ms.author: sipastak
4+
ms.service: azure-local
5+
ms.topic: include
6+
ms.date: 04/11/2025
7+
ms.reviewer: sipastak
8+
---
9+
10+
- Ensure the VMs are powered on throughout the replication process and up to planned failover (migration).
11+
12+
- For VMware VMs, ensure that **VMware Tools** are installed.
13+
14+
- For Hyper-V VMs, ensure that **Hyper-V Integration Services** are installed. For more information, see [Manage Hyper-V Integration Services](/windows-server/virtualization/hyper-v/manage/manage-hyper-v-integration-services).

azure-local/migrate/migrate-maintain-ip-addresses.md

Lines changed: 109 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Maintain static IP addresses during migration (preview)
33
description: Learn how to maintain static IP addresses for VMs during migration.
44
author: alkohli
55
ms.topic: how-to
6-
ms.date: 02/10/2025
6+
ms.date: 04/14/2025
77
ms.author: alkohli
88
ms.reviewer: alkohli
99
---
@@ -12,13 +12,17 @@ ms.reviewer: alkohli
1212

1313
[!INCLUDE [applies-to](../includes/hci-applies-to-23h2.md)]
1414

15-
This article explains how to preserve static IP addresses during virtual machine (VM) migration to Azure Local using Azure Migrate. It provides detailed instructions for running the static IP migration scripts on Windows VMs, and supporting guest operating systems from Windows Server 2012 R2 and later. This applies to both Hyper-V migration and VMware migration.
15+
This article explains how to preserve static IP addresses during virtual machine (VM) migration to Azure Local using Azure Migrate. It provides detailed instructions for running the static IP migration scripts on Windows and Linux VMs.
1616

1717
## About the static IP migration package
1818

19-
Download the [Windows static IP migration package](https://aka.ms/hci-migrate-static-ip-download) (.zip format).
19+
For Windows VMs, this article supports guest operating systems from Windows Server 2012 R2 and later. For Linux VMs, it supports Ubuntu, Red Hat Enterprise Linux, CentOS, and Debian distributions.
2020

21-
The .zip file includes the following scripts:
21+
Download the [static IP migration package](https://aka.ms/hci-migrate-static-ip-download) (.zip format). The .zip file includes different scripts for Windows and Linux VMs.
22+
23+
# [Windows](#tab/windows)
24+
25+
The following scripts are included for Windows:
2226

2327
- **Prepare-MigratedVM.ps1** – Prepares the VM for static IP migration using the `-StaticIPMigration` cmdlet, which runs the *Initialize-StaticIPMigration.ps1* script.
2428

@@ -28,88 +32,115 @@ The .zip file includes the following scripts:
2832

2933
- **Set-StaticIPConfiguration.ps1** - Runs at VM startup to apply the network interface configuration file generated.
3034

31-
- **Utilities.psm1** - Contains helper functions for the scripts.
35+
- **Utilities.psm1** - This script contains helper functions for the scripts.
3236

33-
> [!NOTE]
34-
> Static IP address migration is currently available only for Windows VMs, and is not supported for Linux VMs.
37+
# [Linux](#tab/linux)
3538

36-
## Prerequisites
39+
The following scripts are included for Linux:
3740

38-
Before you begin, prepare the source and target environments for IP migration.
41+
- **prepare_migrated_vm.sh** – Prepares the VM for static IP migration using the `-o StaticIPMigration` option. It executes the *initialize_static_ip_migration.sh* script.
3942

40-
### Prepare source VMs for IP migration
43+
- **initialize_static_ip_migration.sh** - Collects the VM's network interface information into a configuration file (*interface_configurations* in the local directory) and installs a cron job to execute the *set_static_ip_configuration.sh script*.
4144

42-
To migrate VMs with static IPs from the source system (Hyper-V or VMware), follow these steps:
45+
- **set_static_ip_configuration.sh** - Runs at VM startup to apply the network interface configuration file generated.
4346

44-
1. Ensure the VMs are powered on throughout the replication process and up to planned failover (migration).
47+
- **utilities.sh** – This script contains helper functions for the scripts.
4548

46-
1. For VMware VMs, ensure that **VMware Tools** are installed.
49+
---
4750

48-
1. For Hyper-V VMs, ensure that **Hyper-V Integration Services** are installed. For more information, see [Manage Hyper-V Integration Services](/windows-server/virtualization/hyper-v/manage/manage-hyper-v-integration-services).
51+
## Prerequisites
4952

50-
1. For Linux VMs, ensure that **Linux Integration Services** are installed.
53+
# [Windows](#tab/windows)
5154

52-
1. Ensure the preparation script is run on the source VM by an account with administrator privileges to create scheduled tasks.
55+
Before you begin, prepare the source and target environments for IP migration.
5356

54-
### Prepare target Azure Local instance and logical network
57+
### Prepare source VMs for IP migration
5558

56-
On the target Azure Local instance, provision a static Azure Arc logical network to support the migration. This setup requires defining the IP address space, gateway address, DNS servers, and optionally an IP pool range.
59+
To migrate Windows VMs with static IPs from the source system (Hyper-V or VMware), make sure the following requirements are met.
5760

58-
For detailed guidance on creating and configuring static or dynamic Azure Arc logical networks, see [Create logical networks for Azure Local](../manage/create-logical-networks.md?tabs=azurecli).
61+
[!INCLUDE [static-ip-migration-prerequisites](../includes/static-ip-migration-prerequisites.md)]
5962

60-
Ensure that the static IP addresses you plan to migrate are available in the static logical network and not assigned to another VM. If an IP address is already in use, the migration will fail with the error: "The address is already in use." To avoid this, go to the target static logical network, check which IP addresses are in use, and remove any NICs assigned to the static IPs you want to migrate.
63+
- Ensure the preparation script is run on the source VM by an account with administrator privileges to create scheduled tasks.
6164

62-
:::image type="content" source="./media/migrate-maintain-ip-addresses/connected-devices.png" alt-text="Screenshot of Connected Devices page." lightbox="./media/migrate-maintain-ip-addresses/connected-devices.png":::
65+
[!INCLUDE [static-ip-migration-prepare-target](../includes/static-ip-migration-prepare-target.md)]
6366

6467
### (Optional) Prepare to deploy IP migration at scale using group policy
6568

66-
To use this method, you need domain administrator privileges and access to the Group Policy Editor. Additionally, one of the following conditions must be met:
69+
To use this method, you need domain administrator privileges and access to the Group Policy Editor. Additionally, one of the following conditions must be met:
6770

6871
- The source VMs must have internet access to download the static IP migration package directly to their local file system.
6972

7073
- The source VMs must have read-only access to a remote file share hosting the static IP migration package, which must be prepared and downloaded to the remote share in advance.
7174

72-
## Set up IP migration manually
75+
# [Linux](#tab/linux)
76+
77+
Before you begin, prepare the source and target environments for IP migration.
78+
79+
### Prepare source VMs for IP migration
80+
81+
To migrate Linux VMs with static IPs from the source system (Hyper-V or VMware), make sure the following requirements are met.
82+
83+
[!INCLUDE [static-ip-migration-prerequisites](../includes/static-ip-migration-prerequisites.md)]
84+
85+
- For Linux VMs, ensure that **Linux Integration Services** are installed.
86+
87+
- Ensure the preparation script is run on the source VM by an account with administrator privileges to create scheduled tasks. For Linux VMs, the account should also have the appropriate privileges to run network administration commands (such as `ip`, `resolvectl`, and its variants).
88+
89+
[!INCLUDE [static-ip-migration-prepare-target](../includes/static-ip-migration-prepare-target.md)]
90+
91+
---
92+
93+
## Set up IP migration
94+
95+
Follow these steps to set up IP migration. The steps are different for Windows and Linux VMs.
96+
97+
# [Windows](#tab/windows)
98+
99+
For Windows VMs, you can set up IP migration manually or by using group policy.
100+
101+
### Set up IP migration manually
102+
103+
To set up IP migration manually for Windows VMs:
73104

74105
1. Download the .zip file and install the static IP migration package contents onto a local folder on the VM.
75106

76-
1. Open a PowerShell console and run the *Prepare-MigratedVM.ps1* script with the following command:
107+
1. Open PowerShell as an administrator and run the *Prepare-MigratedVM.ps1* script with the following command:
77108

78109
```powershell
79110
.\Prepare-MigratedVM.ps1 -StaticIPMigration 
80111
```
81112
82-
1. In Azure portal, create a migration project, trigger discovery, and replicate the VM. For more information, see [Create an Azure Migrate project](migration-options-overview.md).
113+
1. In the Azure portal, create a migration project, trigger discovery, and replicate the VM. For more information, see [Create an Azure Migrate project](migration-options-overview.md).
83114
84115
1. Before you select the VMs to migrate, use the Replication Wizard to assign and configure the correct logical networks for each network interface on the source VM.
85116
86117
1. In the **Replications > General > Compute and Network** section, select **VM**. On this tab, ensure that the network interfaces are assigned to the correct logical network. DHCP network interfaces are assigned to dynamic logical networks, and static network interfaces are assigned to static logical networks.
87118
88119
:::image type="content" source="./media/migrate-maintain-ip-addresses/compute-network.png" alt-text="Screenshot of Compute and Network page." lightbox="./media/migrate-maintain-ip-addresses/compute-network.png":::
89120
90-
Failure to correctly assign the network interfaces to their corresponding logical networks results in incorrect IP address information displayed in Azure Arc and Azure portal.
121+
Failure to correctly assign the network interfaces to their corresponding logical networks results in incorrect IP address information displayed in Azure Local and Azure portal.
91122
92123
1. On the **Migrate** view, under **Shut down virtual machines**, select **Yes, shut down virtual machines (ensures no data loss)**.
93124
94125
:::image type="content" source="./media/migrate-maintain-ip-addresses/shut-down-vms.png" alt-text="Screenshot of Shut down VMs panel." lightbox="./media/migrate-maintain-ip-addresses/shut-down-vms.png":::
95126
96127
1. After the VM is migrated, check the migrated VM to verify that the static IP settings were migrated over.
97128
98-
## Set up IP migration using group policy
129+
### Set up IP migration using group policy
99130
100131
Follow these steps to set up static IP migration at scale on domain-joined VMs using group policy.
101132
102133
- Review the prerequisites listed for static IP migrations using group policy.
103134
104-
### Create a group policy object
135+
#### Create a group policy object
105136
106137
1. Open the Group Policy Management Console for your Active Directory (AD) environment.
107138
108139
1. In your AD forest, navigate to the location that contains the VMs you want to migrate with preserved static IPs.
109140
110141
1. Right-click and select **Create a GPO on this domain, and Link it here**.
111142
112-
1. When prompted, assign a descriptive name to this GPO:
143+
1. When prompted, assign a descriptive name to this Group Policy Object (GPO):
113144
114145
:::image type="content" source="./media/migrate-maintain-ip-addresses/group-policy-management.png" alt-text="Screenshot of the GPO menu item." lightbox="././media/migrate-maintain-ip-addresses/group-policy-management.png":::
115146
@@ -121,7 +152,7 @@ Follow these steps to set up static IP migration at scale on domain-joined VMs u
121152
122153
1. Right-click the blank area under **Scheduled Tasks** and select **New > Immediate Task (At least Windows 7)**.
123154
124-
### Define the scheduled task
155+
#### Define the scheduled task
125156
126157
1. Select **New > Immediate Task**. When the Scheduled Task Wizard opens, configure each tab as follows:
127158
@@ -133,7 +164,7 @@ Follow these steps to set up static IP migration at scale on domain-joined VMs u
133164
134165
1. Select **Run whether user is logged on or not**.
135166
136-
1. Select**Run with highest privileges**.
167+
1. Select **Run with highest privileges**.
137168
138169
1. Under **Configure for**, select **Windows Vista or Windows Server 2008** for configuration:
139170
@@ -164,11 +195,11 @@ Follow these steps to set up static IP migration at scale on domain-joined VMs u
164195
165196
1. Select **OK** to finalize the scheduled task configuration.
166197
167-
### Apply the group policy object
198+
#### Apply the group policy object
168199
169200
1. Link the GPO to the desired Organizational Unit (OU):
170201
171-
1. If the GPO is not already linked, right-click the desired OU in the Group Policy Management Console and select **Link an existing GPO**.
202+
1. If the GPO isn't already linked, right-click the desired OU in the Group Policy Management Console and select **Link an existing GPO**.
172203
173204
1. Select the GPO you created.
174205
@@ -180,24 +211,66 @@ Follow these steps to set up static IP migration at scale on domain-joined VMs u
180211
181212
1. Ensure that a scheduled task named `Set-StaticIpConfiguration` has been created to run on restart.
182213
214+
# [Linux](#tab/linux)
215+
216+
For Linux VMs, follow these steps to set up IP migration manually.
217+
218+
### Set up IP migration manually
219+
220+
To set up IP migration manually for Linux VMs:
221+
222+
1. Download the .zip file and install the static IP migration package contents onto a local folder on the VM.
223+
224+
1. Open a terminal session and run the *prepare_migrated_vm.sh* script with the following commands:
225+
226+
```Bash
227+
chmod u+x prepare_migrated_vm.sh
228+
sudo ./prepare_migrated_vm.sh -o StaticIPMigration
229+
```
230+
231+
1. In the Azure portal, create a migration project, trigger discovery, and replicate the VM. For more information, see [Create an Azure Migrate project](migration-options-overview.md).
232+
233+
1. Before you select the VMs to migrate, use the Replication Wizard to assign and configure the correct logical networks for each network interface on the source VM.
234+
235+
1. In the **Replications > General > Compute and Network** section, select **VM**. On this tab, ensure that the network interfaces are assigned to the correct logical network. DHCP network interfaces are assigned to dynamic logical networks, and static network interfaces are assigned to static logical networks.
236+
237+
:::image type="content" source="./media/migrate-maintain-ip-addresses/compute-network.png" alt-text="Screenshot of Compute and Network page." lightbox="./media/migrate-maintain-ip-addresses/compute-network.png":::
238+
239+
Failure to correctly assign the network interfaces to their corresponding logical networks results in incorrect IP address information displayed in Azure Local and Azure portal.
240+
241+
1. On the **Migrate** view, under **Shut down virtual machines**, select **Yes, shut down virtual machines (ensures no data loss)**.
242+
243+
:::image type="content" source="./media/migrate-maintain-ip-addresses/shut-down-vms.png" alt-text="Screenshot of Shut down VMs panel." lightbox="./media/migrate-maintain-ip-addresses/shut-down-vms.png":::
244+
245+
1. After the VM is migrated, check the migrated VM to verify that the static IP settings were migrated over.
246+
247+
---
248+
183249
## Known limitations
184250
185251
These are the known limitations and display issues when migrating static IP addresses:
186252
187253
### Old network adapter information in Device Manager
188254
189-
After migration, Device Manager may still display the old network adapter information from pre-migration. While this does not affect the new network adapter created post-migration and will not cause IP conflicts, the script doesn't currently delete this old registration, so it remains visible.
255+
After migration, Device Manager may still display the old network adapter information from pre-migration. While this doesn't affect the new network adapter created post-migration and won't cause IP conflicts, the script doesn't currently delete this old registration, so it remains visible.
190256
191257
### Multiple IP addresses on a single network adapter
192258
193-
When the source VM has multiple static IP addresses assigned to a single network adapter, those IP addresses are correctly assigned on the migrated VM. However, Arc VMs in Azure Local will display only one IP address per network adapter in Arc portal. This is a known display issue in the Arc portal and does not affect the actual functionality of the IP addresses on the migrated VM.
259+
When the source VM has multiple static IP addresses assigned to a single network adapter, those IP addresses are correctly assigned on the migrated VM. However, Azure Local VMs enabled by Azure Arc in Azure Local display only one IP address per network adapter in Azure Local portal. This is a known display issue in the Azure Local portal and does not affect the actual functionality of the IP addresses on the migrated VM.
194260
195261
### Multiple network adapters and types
196262
197-
If the source VM has multiple network adapters with a mix of DHCP and static configurations, the migrated VM will preserve the correct number of network adapter, network adapter types, and static IP addresses on the static network adapter. However, the Arc portal view of the migrated VM may incorrectly display duplicate or inaccurate IPs on the network adapters. This is a known display issue in the Arc portal and doesn't impact the functionality of the IP addresses on the migrated VM. See the example below of a migrated VM with a DHCP network adapter and a static network adapter.
263+
If the source VM has multiple network adapters with a mix of DHCP and static configurations, the migrated VM will preserve the correct number of network adapter, network adapter types, and static IP addresses on the static network adapter. However, the Azure Local portal view of the migrated VM may incorrectly display duplicate or inaccurate IPs on the network adapters. This is a known display issue in the Azure Local portal and doesn't impact the functionality of the IP addresses on the migrated VM. See the example below of a migrated VM with a DHCP network adapter and a static network adapter.
198264
199265
:::image type="content" source="./media/migrate-maintain-ip-addresses/display-issue.png" alt-text="Screenshot of network adapters." lightbox="./media/migrate-maintain-ip-addresses/display-issue.png":::
200266
267+
### IPv6 static IP addresses not supported
268+
269+
Azure Local VMs currently only support IPv4 addresses. NICs configured with IPv6 addresses will not be migrated, as IPv6 is not supported.
270+
271+
## Logs
272+
273+
When configuring static IP migration for VMs using the *Prepare-MigratedVM.ps1* or *prepare_migrated_vm.sh* script, logs are automatically created in the script's directory.
201274
202275
## Next steps
203276

0 commit comments

Comments
 (0)