When trying to change the default gateway of a TCP/IP stack in the ESXi Host Client (such as the vMotion stack) the following error is received:
When trying to change other settings these errors may be received:
In certain cases, due to a user interface limitation, it is not possible for the default gateway setting for a TCP/IP stack other than the Default TCP/IP stack to be saved from the ESXi Host Client.
This setting can be set successfully in vSphere Client. vSphere Client is the recommended method of managing hosts that are connected to a vCenter.
Solution:
Log in to vSphere Client, then click on the host you are managing. Select Configure, Networking, TCP/IP configuration.
Select the ellipsis (...) next to the TCP/IP stack you want to configure, i.e. vMotion. Next to VMkernel gateway enter the default gateway then select OK.
It is also possible to change this setting using the command line.
esxcfg-route -a default 172.16.0.1 -N "vmotion"
oresxcfg-route -a 0.0.0.0/0 172.16.0.1 -N "vmotion"
Replace "vmotion" with the name of your custom TCP/IP stack if necessary (obtain from 'esxcli network ip netstack list') and replace 172.16.0.1 with the default gateway you wish to set.
Confirm changes with esxcfg-route -l -N "vmotion"
As an alternative, it is possible to set the gateway for an individual VMkernel. There are two ways to do this:
esxcli network ip interface ipv4 set --interface-name vmk2 --gateway 172.16.0.1 --type static --ipv4 172.16.254.99 --netmask 255.255.255.0