Search the VMware Knowledge Base (KB)
View by Article ID

Configuring a VMkernel port and enable vMotion via command line (1006989)

  • 27 Ratings

Details

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.


Solution

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:

Tags

vmkernel-port

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 27 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.

What can we do to improve this information? (4000 or fewer characters)




Please enter the Captcha code before clicking Submit.
  • 27 Ratings
Actions
KB: