Setting the vSwitch load balance policy using command line on an ESX host
search cancel

Setting the vSwitch load balance policy using command line on an ESX host

book

Article ID: 308587

calendar_today

Updated On:

Products

VMware vSphere ESX 8.x VMware vSphere ESX 7.x VMware vSphere ESX 6.x

Issue/Introduction

This article outlines steps for setting up the vSwitch load balance policy in an ESXi host using the command line.

Environment

VMware vSphere ESXi 6.X
VMware vSphere ESXi 7.X
VMware vSphere ESXi 8.X

Resolution

Note: Before you begin, see Restarting the Management agents on an ESX or ESXi Server (1003490) for important information on restarting the management service.

In this example, the physical switch is set to use for static port-channel / EtherChannel and IP hash, set load balance policy using the command line interface.

  1. Check the current vSwitch settings, run the command:
    esxcfg-vswitch -l
    esxcli network vswitch standard list

  2. Check the current uplink, run the command:
    esxcli network vswitch standard list -v vSwitchX

  3. Add an uplink with the command:
    esxcli network vswitch standard uplink add -u vmnic0 -v vSwitchX

  4. Verify teamed uplinks with the command:
    esxcli network vswitch standard policy failover get -v vSwitchX
    esxcli network vswitch standard portgroup policy failover get -p "Management Network"

  5. Set load balancing policy. The options are:
    • Port ID = portid
    • IP Hash = iphash
    • MAC = mac
    • Explicit Failover = explicit

      For example:
      esxcli network vswitch standard policy failover set -l portid -v vSwitchX ( for Specific vSwitchX )
      esxcli network vswitch standard portgroup policy failover set -l portid -p "Management Network" ( for specific Portgroup )

  6. Restart the management service with the command:
    /etc/init.d/hostd restart
    /etc/init.d/vpxa restart

  7. Ping the gateway to confirm connectivity:
    ping x.x.x.x

Additional Information

For ESXi, see Restarting the Management agents on an ESX or ESXi Server (1003490) for important information on restarting the management service.