Help Center/ Server Migration Service/ Best Practices/ Using MgC to Migrate Servers Without Internet Access over Private Lines
Updated on 2025-06-06 GMT+08:00

Using MgC to Migrate Servers Without Internet Access over Private Lines

Overview

This section explains how to use Migration Center (MgC) to migrate servers without Internet access to the LA-Sao Paulo1 region.

This solution only applies to migration to the LA-Sao Paulo1 region.

Step 1: Install the MgC Agent

  1. Log in to the Huawei Cloud console and enable MgC in the LA-Sao Paulo1 region.
  2. On the MgC console, choose MgC Agent in the navigation pane. Download and install the MgC Agent for Windows.
  3. After the MgC Agent is installed, register an account and connect the MgC Agent to MgC.

Step 2: Download the SMS-Agent Installation Packages

  1. Log in to the SMS console and switch to the LA-Sao Paulo1 region.
  2. In the navigation pane, choose Agents.
  3. Download the SMS-Agent installation packages and SHA256 verification files for Linux and Windows.
  4. Save all the downloaded SMS-Agent installation packages and verification files into the same directory on the server where the MgC Agent is installed.

Step 3: Configure the Server with the MgC Agent Installed as a Web Server

  1. On the server with the MgC Agent installed, open PowerShell ISE, and copy and paste the following script content. Then modify the script as follows:

    • Replace 127.0.0.1 in the first line with the private IP address of the server with the MgC Agent installed.
    • Replace the value of sitePath in the second line with the directory where the SMS-Agent installation packages are stored from step 2.
      $SMSAgentServerEndpoint = "127.0.0.1:443"
      $sitePath = "C:\Users\Administrator\Downloads\SMS-Agent"
      
      # Install IIS
      Install-WindowsFeature -name Web-Server -IncludeManagementTools
      
      # Create Website content
      if (-Not (Test-Path $sitePath)) {
          New-Item -Path $sitePath -ItemType Directory
      }
      
      # Add IIS website
      Import-Module WebAdministration
      New-Item "IIS:\Sites\SMSAgentServer" -bindings @{protocol="http";bindingInformation="$SMSAgentServerEndpoint" + ":"} -physicalPath $sitePath
      
      # Enable content browse
      Set-WebConfigurationProperty -filter "system.webServer/directoryBrowse" -name "enabled" -value "true" -PSPath "IIS:\Sites\SMSAgentServer"
      
      # Set folder permissions
      $acl = Get-Acl $sitePath
      $acl.SetAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("IUSR","ReadAndExecute","ContainerInherit,ObjectInherit","None","Allow")))
      $acl.SetAccessRule((New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS","ReadAndExecute","ContainerInherit,ObjectInherit","None","Allow")))
      Add-WebConfigurationProperty -PSPath 'IIS:\Sites\SMSAgentServer' -filter 'system.webServer/staticContent' -name '.' -value @{fileExtension='.sha256'; mimeType='application/sha256'}
      
      Set-Acl $sitePath $acl
      
      # Restart IIS service
      Restart-Service -Name "W3SVC"
      $response = Invoke-WebRequest -Uri $SMSAgentServerEndpoint -UseBasicParsing
      if ($response.StatusCode -eq 200) {
          Write-Output "Construct SMS agent server successfully!"
      }
      
      #Replace MgC-Agent SMS download url
      $filePath = "C:\MgC-Agent\config\application.yml"
      $urlPattern = "sms-agent-url:.*"
      $newUrl = "sms-agent-url: http://" + $SMSAgentServerEndpoint
      $fileContent = Get-Content -Path $filePath -Encoding UTF8
      $fileContent = $fileContent -replace $urlPattern, $newUrl
      Set-Content -Path $filePath -Value $fileContent -Encoding UTF8
      
      #Restart MgC-Agent
      Write-Output "Restarting MgC-Agent.Please wait for a while..."
      Restart-Service -Name "MgC-Agent"
      Write-Output "Starting MgC-Agent.Please wait about 30 seconds"
      Start-Sleep -Seconds 30
      Write-Output "Start MgC-Agent successfully"

  2. Run the script and wait until the script execution is complete. If the message "Start MgC-Agent successfully" is displayed, the configuration is successful.

Step 4: Create a Server Migration Workflow on MgC

Go to the MgC console and create a server migration workflow by referring to Migrating On-premises Servers to Huawei Cloud.