VMkernel interfaces are used by ESX/ESXi host's internal TCP/IP stack for three purposes:
-
To facilitate VMotion between ESX hosts
-
To connect to iSCSI storage arrays (IP SAN)
-
To connect to NFS storage servers (NAS)
Like a traditional TCP/IP stack, the VMkernel TCP/IP stack provides the ability to route IP datagrams to remote subnets. Although VMware does not recommend that VMotion traffic be routed, both iSCSI and NFS traffic may be routed through a gateway to reach a storage server on a different subnet.
This routing gateway, called the VMkernel gateway, is the IP address of a router or Layer 3 switch on the same subnet as the VMkernel interface itself. This router (or L3 switch) is then responsible for forwarding the VMkernel's IP datagrams in the direction of the destination subnet.
If a VMkernel gateway is specified with an IP address that does not exist within any of the defined VMkernel interfaces' subnets, the Unable to set VMkernel gateway error message appears on system startup. For example, consider the following output:
[root@ESX1 root]# esxcfg-vmknic -l
Port Group IP Address Netmask Broadcast MAC Address MTU Enabled
iSCSI_SAN 192.168.1.100 255.255.255.0 192.168.1.255 MAC_Address1 1514 true
VMotion 192.168.2.100 255.255.255.0 192.168.2.255 MAC_Address2 1514 true
The esxcfg-vmknic -l command provides a listing of all VMkernel interfaces defined on an ESX host. In the example above, there are two VMkernel interfaces:
However, if we verify the IP address that has been assigned to the VMkernel gateway address, we discover an issue:
[root@ESX1 root]# esxcfg-route -l
VM Kernel Routes:
Network Netmask Gateway
192.168.1.0 255.255.255.0 Local Subnet
192.168.2.0 255.255.255.0 Local Subnet
default 0.0.0.0 192.168.0.254
The esxcfg-route -l command provides a listing of all routing table entries within the VMkernel TCP/IP stack. In the example above, the default entry (which corresponds to the VMkernel gateway address) shows a gateway address of 192.168.0.254. Because 192.168.0.254 exists on the 192.168.0.0/24 network and we have no VMkernel interfaces defined on this network, ESX host considers this a misconfiguration and produces the Unable to set VMkernel gateway as there are not VMkernel interfaces on the same network error on startup.
This error message can be safely ignored if routing is not required on the various VMkernel interfaces. However, if a VMkernel gateway is required in order to reach a remote iSCSI or NFS storage server, it must be configured and valid.
The VMkernel gateway is easily configured as follows:
-
Using VMware Infrastructure (VI) Client, connect to the ESX host you wish to modify. Alternatively, you may connect to the VirtualCenter server that manages this ESX host.
-
Select the ESX host in the inventory, and click the Configuration tab.
-
Under the Hardware list, select Networking.
-
Identify the vSwitch that contains the VMkernel interface to be modified and click Properties.
-
In the vSwitch Properties window, select the appropriate VMkernel interface and click Edit.
-
In the Properties window for the VMkernel interface, click Edit next to "VMkernel Default Gateway".
-
In the DNS and Routing Configuration window, specify the correct default gateway address.
-
Click OK to commit the VMkernel default gateway.
-
Click OK to commit the VMkernel interface changes.
-
To configure the VMkernel gateway using the command line:
- To see the default gateway of VMkernel, run the command:
# esxcfg-route
- To set the default gateway of VMkernel, run the command:
# esxcfg-route <IP address>
- To add a route to the VMkernel, run the command:
esxcfg-route -a [<network> <gateway>] | <default gateway>
For example:
- To add a route to 192.168.100.0 network through 192.168.0.1, run the command:
esxcfg-route -a 192.168.100.0/24 192.168.0.1
Or
esxcfg-route -a 192.168.100.0 255.255.255.0 192.168.0.1
- To set the VMkernel default gateway to 192.168.0.1, run the command:
esxcfg-route 192.168.0.1
Or
esxcfg-route -a default 192.168.0.1
Note: You can specify additional IP and subnet for the VMkernel adapter, but there can only be one default gateway.
Additional Information
For translated versions of this article, see: