Configuring a VMkernel port and enable vMotion via command line
search cancel

Configuring a VMkernel port and enable vMotion via command line

book

Article ID: 324812

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

VMware recommends using VirtualCenter and Virtual Infrastructure Client (VI Client) for provisioning virtual switches. For more information, see the ESX Administration Guide.

For the purpose of troubleshooting or if you lack a GUI, the command line interface can be utilized to provision virtual switches.

This article provides commands for creating and modifying the VMkernel port.

The VMkernel layer 3 TCP/IP stack handles traffic for the following ESX host services:
  • VMware vMotion
  • iSCSI
  • NFS

Note: VMware recommends using isolated network for iSCSI.



Environment

VMware ESXi 4.0.x Installable
VMware ESX 4.1.x
VMware ESXi 4.1.x Installable
VMware ESXi 4.0.x Embedded
VMware ESXi 3.5.x Installable
VMware ESXi 4.1.x Embedded
VMware vSphere ESXi 5.0
VMware ESX Server 3.5.x
VMware vSphere ESXi 5.1
VMware ESX 4.0.x
VMware ESXi 3.5.x Embedded

Resolution

Create a VMkernelPort on vSwitch via the command line:
esxcfg-vmknic --add --ip=x.x.x.x --netmask=x.x.x.x portgroup
esxcfg-vmknic --enable portgroup
Example:
esxcfg-vswitch –l (List vSwitch)
esxcfg-vswitch –a vSwitch1 (Create vSwitch)
esxcfg-vswitch –A “ISCSI” vSwitch1 (Create port group)
esxcfg-vmknic -a -i 10.10.10.33 -n 255.255.255.0 ISCSI (Assign IP)
esxcfg-vmknic –l (List VMkernelPort)
Note: You can have more than one VMkernel on one vSwitch. However, the primary default gateway of the Management VMkernel is used for all the subsequent VMkernel(s).
If you are unable to set the VMkernel gateway because there are no VMkernel interfaces on the same network, see Unable to set VMkernel gateway as there are no VMkernel interfaces on the same network (1002662).
Enable vMotion on vSwitch via the command line:
  • Enable a VirtualNic to be used as the vMotion NIC.
  • Enable and Disable vMotion via SSH connection without VirtualCenter (for ESX/ESXi 3.x use vmware-vim-cmd command)
vim-cmd hostsvc/vmotion/vnic_set [vnic]   
vim-cmd hostsvc/vmotion/vnic_set vmk0  
Disabling vMotion Port: 

vim-cmd hostsvc/vmotion/vnic_unset [vnic]

vim-cmd hostsvc/vmotion/vnic_unset vmk0
Check vSwitch vMotion configuration:
vim-cmd hostsvc/vmotion/netconfig_get

The output appears similar to:

[root@esxserver root]# vim-cmd hostsvc/vmotion/netconfig_get

(vim.host.VMotionSystem.NetConfig) {

dynamicType = <unset>,

candidateVnic = (vim.host.VirtualNic) [

(vim.host.VirtualNic) {

dynamicType = <unset>,

device = "vmk0",

key = "key-vim.host.VirtualNic-vmk0",

portgroup = "ISCSI",

spec = (vim.host.VirtualNic.Specification) {

dynamicType = <unset>,

ip = (vim.host.IpConfig) {

dynamicType = <unset>,

dhcp = false,

ipAddress = "xx.xx.xx.xx",

subnetMask = "255.255.255.0",

},

mac = "xx:xx:xx:xx:xx:xx",

},

port = <unset>,

}

],

selectedVnic = <vim.host.VirtualNic:key-vim.host.VirtualNic-vmk0>,

}

Note: If you see this line, vMotion is enabled.

<vim.host.VirtualNic:key-vim.host.VirtualNic-vmk0>

Additional Information

For translated versions of this article, see: