你可以用 powercli 做到这一点:
$vs = Get-VirtualSwitch -VMHost $vmhost -Name "vSwitch0"
$nics = (Get-VirtualSwitch -VMHost $vmhost).Nic
$policy1 = Get-VirtualPortgroup -VirtualSwitch $vs -VMHost $vmhost -Name 'net2' | Get-NicTeamingPolicy
$policy1 | Set-NicTeamingPolicy -MakeNicActive $nics[0] -MakeNicStandby $nics[1] # this will set the order
$policy1 | Set-NicTeamingPolicy -InheritFailoverOrder $true # this will uncheck/check the failover inherit tick
如果使用 esxcli:
首先我们获取当前设置(不检查覆盖)
[root@esx:~] esxcli network vswitch standard portgroup policy failover get -p net2
Load Balancing: srcport
Network Failure Detection: link
Notify Switches: true
Failback: true
Active Adapters: vmnic5, vmnic4
Standby Adapters:
Unused Adapters:
Override Vswitch Load Balancing: false
Override Vswitch Network Failure Detection: false
Override Vswitch Notify Switches: false
Override Vswitch Failback: false
Override Vswitch Uplinks: false
接下来我们运行命令来设置我们想要的nicorder并再次检查。
[root@esx:~] esxcli network vswitch standard portgroup policy failover set -a vmnic5 -s vmnic4 -p net2
[root@esx:~] esxcli network vswitch standard portgroup policy failover get -p net2
Load Balancing: srcport
Network Failure Detection: link
Notify Switches: true
Failback: true
Active Adapters: vmnic5
Standby Adapters: vmnic4
Unused Adapters:
Override Vswitch Load Balancing: false
Override Vswitch Network Failure Detection: false
Override Vswitch Notify Switches: false
Override Vswitch Failback: false
Override Vswitch Uplinks: true
这将勾选覆盖复选框并将活动 nic 设置为 vmnic5 并将 stby 设置为 vmnic4
祝你好运帕吉特