Kapcsolódás a gazdagép virtuális hálózati (parancsfájl)
Hatókör: System Center 2012 R2 Virtual Machine Manager, System Center 2012 - Virtual Machine Manager
A logikai hálózatok virtuális gépek számára elérhetővé tenni a külső virtuális hálózaton, a fizikai hálózati adapterre egy gazdagépen logikai hálózat társítani, és a virtuális hálózati beállítások konfigurálása.
További információ a Hyper-V-gazdagépek hálózati beállításainak konfigurálásáról: hálózati beállítások megadása egy Hyper-V gazdagépen.
A következő parancsfájlt a bemenete a VMHostName
, LogNetName
, HostAdapterName
, és VirtualNetName
paraméterek és egy logikai hálózatot a gazdagép társítja. A parancsfájl létrehoz egy virtuális hálózatot a gazdagépen.
# Description: This script associates a virtual machine host with a logical
# network and then creates a virtual network for the host.
Param (
[parameter(Mandatory=$true)]
[String] $VMHostName=$(throw "Please provide the name of a virtual machine host."),
[parameter(Mandatory=$true)]
[String] $LogNetName=$(throw "Please provide the name of a logical network."),
[parameter(Mandatory=$true)]
[String] $HostAdapterName=$(throw "Please provide the name of the host adapter."),
[parameter(Mandatory=$true)]
[String] $VirtualNetName=$(throw "Please provide the virtual network name.")
)
# Get the virtual machine host.
$VMHost = Get-SCVMHost -ComputerName $VMHostName
# Get the logical network.
$LogNet = Get-SCLogicalNetwork -Name $LogNetName
# Get the network adapter for the host.
$HostAdapter = Get-SCVMHostNetworkAdapter -VMHost $VMHost -Name $HostAdapterName
# Set the logical network on the host.
Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $HostAdapter -AddOrSetLogicalNetwork $LogNet
# Create the virtual network.
New-SCVirtualNetwork -Name $VirtualNetName -Description "External virtual network for $VMHost" -VMHost $VMHost -VMHostNetworkAdapter $HostAdapter
Lásd még: