Add and Configure an IPv4 VMkernel Network Interface with ESXCLI

You can add and configure an IPv4 VMkernel NIC by using ESXCLI.

Specify one of the options listed in Connection Options for ESXCLI Host Management Commands in place of <conn_options>.

Procedure

  1. Add a new VMkernel network interface.
    esxcli <conn_options> network ip interface add --interface-name=vmk<X> --portgroup-name=<my_portgroup>
    You can specify the MTU setting after you have added the network interface by using esxcli network ip interface set --mtu.
  2. Configure the interface as an IPv4 interface.
    You must specify the IP address by using --ip, the netmask, and the name. For the following examples, assume that VMSF-VMK-363 is a port group to which you want to add a VMkernel network interface.
    esxcli <conn_options> network ip interface ipv4 set --ipv4=<ip_address> --netmask=255.255.255.0 --type=<value> --interface-name=vmk<X>
    You can set the address as follows.
    • --ipv4=<X.X.X.X> --netmask=<X.X.X.X> --type=static – Static IPv4 address.
    • --type=dhcp – Use IPv4 DHCP.
    The VMkernel supports DHCP only for ESXi 4.0 and later.
    When the command finishes successfully, the newly added VMkernel network interface is enabled.
  3. List information about all VMkernel network interfaces on the system.
    esxcli <conn_options> network ip interface list
    The command displays the network information, port group, MTU, and current state for each virtual network adapter in the system.