To force a different VMkernel port to be used in the host's routing table, all VMkernel ports except the preferred one in the network must be deleted and then re-created:
Warning: Performing the steps below may cause loss of network connectivity to the host's management interface. VMware strongly recommends performing these steps from the direct console command line interface (Local Tech Support Mode) of the host, or by using an iLO/DRAC/IPMI console connection. For more information, see
Using ESXi Shell in ESXi 7.X and 8.X
- Place the host in question into maintenance mode.
- Verify that an non-preferred VMkernel port interface is being used in conjunction with a default gateway via the ESXi Shell, or an SSH connection to the host in question:
~ #esxcfg-route -l
VMkernel Routes:
Network Netmask Gateway Interface
#.#.85.0 255.255.255.0 Local Subnet vmk0
default 0.0.0.0 #.#.85.2 vmk0
In this example, VMkernel port vmk0
is currently being used for traffic between the gateway and the host.
- Identify all VMkernel ports within the same subnet and record all settings: IP address, subnet, VLAN, MTU, vMotion, Fault Tolerance Logging, Management Traffic, and any security policies in place.
- Using the vSphere Client, remove all VMkernel ports within the same subnet, leaving only the preferred interface.
- Using the vSphere Client, select the affected vSwitch and click Properties.
- Click the VMkernel port in question and click Remove.
Note: This can also be done from the command line. For more information, see Configuring vSwitch or vNetwork Distributed Switch from the command line in ESXi/ESX (1008127).
- Verify that the preferred VMkernel interface is now being used in conjunction with the default gateway using the
esxcfg-route
command via the ESXi Shell or SSH session:
~ # esxcfg-route -l
VMkernel Routes:
Network Netmask Gateway Interface
#.#.85.0 255.255.255.0 Local Subnet vmk1
default 0.0.0.0 #.#.85.2 vmk1
- Re-create all of the remaining VMkernel ports removed in step 4 with the settings recorded in step 3.
Note: This change does not persist across reboots. When you reboot the host, the lowest numbered VMK in each subnet becomes the preferred interface again. You must either reapply the change or create the preferred VMK first (lowest numbered) among all the VMKernels in the same subnet. In the example above, vmk0 becomes the primary gateway for 192.168.85.x
subnet after host reboot.