DataCore SANsymphony와 Hyper-V로 HCI 구성을 구성할 때의 네트워크를 파워 쉘로 만든다
준비
#先に必要な機能をインストール
Install-WindowsFeature -Name "Hyper-V", "Failover-Clustering", "Data-Center-Bridging", "RSAT-Clustering-PowerShell", "Hyper-V-PowerShell", "FS-FileServer", "FS-Data-Deduplication" -IncludeManagementTools -IncludeAllSubFeature
#ついでにファイルサーバーも兼ねるなら
Install-WindowsFeature -Name "FS-FileServer", "FS-Data-Deduplication" -IncludeManagementTools -IncludeAllSubFeature
#OSの再起動が必要
#変数(適宜書き換える)
##本番ネットワーク用アダプター名
$prodNicName1 = ""
$prodNicName2 = ""
##iSCSIネットワーク用アダプター名
$iSCSINicName1 = ""
$iSCSINicName2 = ""
##本番ネットワーク用チーミング名
$productionTeamName = "Prod_Team"
##vSwitch名
$productionvSwitchName = "Prod_vSwitch"
$iSCSIvSwitchName1 = "iSCSI01_vSwitch"
$iSCSIvSwitchName2 = "iSCSI02_vSwitch"
##vLAN ID
$ManagementVlan=0
$CsvVlan=302
$HeartbeatVlan=303
$LiveMigrationVlan=304
$FE1Vlan=101
$BE1Vlan=101
$MR1Vlan=102
$FE2Vlan=201
$BE2Vlan=201
$MR2Vlan=202
##MinimumBandwidthWeight
$ManagementWeight=80
$CsvWeight=100
$HeartbeatWeight=90
$LiveMigrationWeight=20
$FEWeight=80
$MRWeight=100
$BEWeight=80
##IPアドレス設定
$ManagementIP = "0.0.0.0"
$ManagementPrefix = "24"
$ManagementGW = "0.0.0.0"
$ManagementDNS = "0.0.0.0"
$CsvIP = "0.0.0.0"
$CsvPfrefix = "24"
$HeartbeatIP = "0.0.0.0"
$HeartbeatPrefix = "24"
$LiveMigrationIP = "0.0.0.0"
$LiveMigrationPrefix = "24"
$FE1IP = "0.0.0.0"
$FE1Prefix = "24"
$MR1IP = "0.0.0.0"
$MR1Prefix = "24"
$BE1IP = "0.0.0.0"
$BE1Prefix = "24"
$FE2IP = "0.0.0.0"
$FE2Prefix = "24"
$MR2IP = "0.0.0.0"
$MR2Prefix = "24"
$BE2IP = "0.0.0.0"
$BE2Prefix = "24"
##本番用のチーミングを作ります
$TEAM = New-NetLbfoTeam -Name "$ProductionTeamName" -TeamMembers "$ProdNicName1","$ProdNicName2" -TeamingMode SwitchIndependent -LoadBalancingAlgorithm IPAddresses -confirm:$false
##本番用のvSwitchを作ります
$VS = New-VMSwitch -Name "$productionvSwitchName" -NetAdapterName $TEAM.name -AllowManagementOS $false -MinimumBandwidthMode weight
##本番用のvNICを作ります
###管理(RDPやインターネット接続)を別のオンボードNICにする時はManagementを削除
$Usage = "Management","Csv","Heartbeat","LiveMigration"
Foreach ($i in $Usage){
$Vlan1 = Get-Variable -Name "${i}Vlan" -ValueOnly
$IP1 = Get-Variable -Name "${i}IP" -ValueOnly
$Prefix1 = Get-Variable -Name "${i}Prefix" -ValueOnly
$Weight1 = Get-Variable -Name "${i}Weight" -ValueOnly
Add-VMNetworkAdapter -Name $i -ManagementOS -SwitchName $VS.name | Set-VMNetworkAdapterVlan -vlanid $Vlan1 -access | Set-VMNetworkAdapter -ManagementOS -MinimumBandwidthWeight $Weight1
$NA = Get-NetAdapter | Where-Object{$_.Name -match $i}
If($i -eq "Management"){
New-NetIPAddress -InterfaceAlias $NA.name -IPAddress $IP1 -AddressFamily IPv4 -PrefixLength $Prefix1 -DefaultGateway $ManagementGW
Set-DnsClientServerAddress -InterfaceAlias $NA.Name -ServerAddresses $managementDNS
}else{
New-NetIPAddress -InterfaceAlias $NA.Name -IPAddress $IP1 -AddressFamily IPv4 -PrefixLength $Prefix1
}
}
##iSCSI vSwitchを作ります
For ($x = 1;$x -le 2;$x++){
$VMSwitchName = Get-Variable -Name "iSCSIvSwitchName${x}" -ValueOnly
$iSCSINicName = Get-Variable -Name "iSCSINicName${x}" -ValueOnly
$VS = New-VMSwitch -Name $VMSwitchName -NetAdapterName $iSCSINicName -AllowManagementOS $false -MinimumBandwidthMode weight
$Role = "FE","MR","BE"
Foreach ($y in $Role){
$Vlan2 = Get-Variable -Name "${y}${x}Vlan" -ValueOnly
$Weight2 = Get-Variable -Name "${y}Weight" -ValueOnly
$IP2 = Get-Variable -Name "${y}${x}IP" -ValueOnly
$Prefix2 = Get-Variable -Name "${y}${x}Prefix" -ValueOnly
##iSCSI用のvNICを作ります
Add-VMNetworkAdapter -Name "iSCSI-${y}0${x}" -ManagementOS -SwitchName $VMSwitchName | Set-VMNetworkAdapterVlan -ManagementOS -vlanid $Vlan2 -access | Set-VMNetworkAdapter -ManagementOS -MinimumBandwidthWeight $Weight2
Get-NetAdapter | Where-Object{$_.Name -match "iSCSI-${y}0${x}"} | New-NetIPAddress -IPAddress $IP2 -AddressFamily IPv4 -PrefixLength $Prefix2
}
}
완료하면 이런 느낌입니다.
Reference
이 문제에 관하여(DataCore SANsymphony와 Hyper-V로 HCI 구성을 구성할 때의 네트워크를 파워 쉘로 만든다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/tsurun/items/22d42224f94e42eff250텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)