@Alex-Zhao
2018-11-29T11:50:21.000000Z
字数 695
阅读 142
vmware虚拟化
在ESXi主机上新建标准交换机并且新建端口组
$hostlist= get-cluster <CLUSTER_NAME> | get-vmhost
$hostlist
foreach ($hosts in $hostlist) {
$hosts.name
$switchs = $hosts | New-VirtualSwitch -Name <SWITCH_NAME> -Nic vmnic5,vmnic4
# $switchs = get-virtualswitch -vmhost $hosts -name vSwitch1
new-virtualportgroup -Virtualswitch $switchs -name '10-vlan10' -vlanid 10
new-virtualportgroup -Virtualswitch $switchs -name '11-vlan11' -vlanid 11
}
在ESXi主机上修改标准交换机的端口组
$hostlist= get-cluster CLUSTER_NAME | get-vmhost
$hostlist
foreach ($hosts in $hostlist) {
$hosts.name
$switchs= get-virtualswitch -vmhost $hosts -name <SWITCH_NAME>
$portgroup=Get-VirtualPortGroup -Name "vlan606" -VMHost $hosts
Set-VirtualPortGroup -VirtualPortGroup $portgroup -vlanid 606 -name 'vlan6'
}