Close Menu
DPC Virtual Tips
    Read More

    How to Troubleshoot Packet Drops on an ESXi Host

    August 16, 2026

    SlurmDBD Is Down: What Continues Working and What Does Not

    August 15, 2026

    How to Investigate Jobs Stuck in COMPLETING State on Slurm

    August 14, 2026
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    • Disclaimer
    Tuesday, August 25
    DPC Virtual Tips
    • Home
    • Operating Systems
    • PowerFlex
    • HPC
    • Virtualization
    • About the Author
    • About Us
    • Contact
    DPC Virtual Tips
    Home » How to configure the network on an ESXi host using the command line
    Virtualization

    How to configure the network on an ESXi host using the command line

    DaniloBy DaniloDecember 14, 2023Updated:July 30, 2026No Comments4 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    Configure ESXi Network Command Line
    Share
    Facebook Twitter LinkedIn Pinterest Email

    How to configure the network on an ESXi host using the command line is an article that explains how to create a standard switch (VSS), a port group (PG), and a management vmkernel interface using the esxcli command.

    Here, we have an ESXi host without any vmkernel interface. Consequently, we cannot access this ESXi using its management IP. The only way to access this host is by using the DCUI:

    Under the above screen, press F2 to enable the DCUI access. In this case, we need to enable the “ESXi Shell”, as we can see in the picture below:

    Press F1 or Alt+F1 to access the DCUI. Now, we have access to the ESXi command line and we can configure the management interface:

    Creating a vSphere Standard Switch (VSS)

    First and foremost, we can check if any standard switch exists here:

    esxcli network vswitch standard list

    Creating a standard switch “vSwitch0”:

    esxcli network vswitch standard add --vswitch-name=vSwitch0

    Creating a vSphere Port Group (PG)

    So, now we can create the port group. If you want, you can list all available port groups using the following command:

    esxcli network vswitch standard portgroup list

    Creating both port groups called “Management Network” and “VM Network”:

    esxcli network vswitch standard portgroup add --portgroup-name="Management Network" --vswitch-name="vSwitch0"
    
    esxcli network vswitch standard portgroup add --portgroup-name="VM Network" --vswitch-name="vSwitch0"

    If necessary, you can set up a VLAN ID for each port group.
    To set up the VLAN ID 10 for the port group “VM Network”, for instance, the command is:

    esxcli network vswitch standard portgroup set -p "VM Network" -v 10

    Creating VMKernel Interface and Associating it to a Port Group

    The next step here is to create the VMKernel interface and associate it with a specific port group.

    Creating the VMkernel interface “vmk0” and associating it to the port group “Management Network”:

    esxcli network ip interface add --interface-name=vmk0 --portgroup-name="Management Network"

    Specifying the IP address configuration for the vmk0 interface. In this case, for instance, the IP address configuration is:

    • IP address: 192.168.255.124
    • Network Mask: 255.255.255.0
    esxcli network ip interface ipv4 set --interface-name=vmk0 --ipv4=192.168.255.124 --netmask=255.255.255.0 --type=static

    Assigning a Default Gateway

    The last step is to define the default gateway. We can do that with the following command.
    In our example, the default gateway IP address is “192.168.255.1”:

    esxcli network ip route ipv4 add --gateway=192.168.255.1 --network=default

    Assigning Uplink Interface to the Standard Switch

    At this moment, our VMKernel interface is configured, but our standard switch does not have any uplink interface.

    The first step here is to check all physical interfaces available (vmnic0):

    esxcli network nic list

    In our case, for instance, we have only one interface available:

    [root@localhost:~] esxcli network nic list
    Name    PCI Device    Driver    Admin Status  Link Status  Speed  Duplex  MAC Address         MTU  Description
    ------  ------------  --------  ------------  -----------  -----  ------  -----------------  ----  -----------
    vmnic0  0000:0b:00.0  nvmxnet3  Up            Up           10000  Full    00:0c:29:94:9a:28  1500  VMware Inc. vmxnet3 Virtual Ethernet Controller
    
    

    Assigning the vmnic0 to the standard switch “vSwitch0”:

    esxcli network vswitch standard uplink add --uplink-name=vmnic0 --vswitch-name=vSwitch0

    After that, our switch has one uplink, as we can see in the following command:

    [root@localhost:~] esxcli network vswitch standard list
    vSwitch0
       Name: vSwitch0
       Class: cswitch
       Num Ports: 1590
       Used Ports: 4
       Configured Ports: 128
       MTU: 1500
       CDP Status: listen
       Beacon Enabled: false
       Beacon Interval: 1
       Beacon Threshold: 3
       Beacon Required By:
       Uplinks: vmnic0
       Portgroups: VM Network, Management Network
    
    

    Testing the Network Connectivity

    If our configuration is fine, we should be able to reach the network devices. We can test the network communication from the ESXi host to the default gateway.
    In our case, the default gateway is 192.168.255.1:

    vmkping 192.168.255.1

    In our case, the communication is working fine:

    [root@localhost:~] vmkping 192.168.255.1
    PING 192.168.255.1 (192.168.255.1): 56 data bytes
    64 bytes from 192.168.255.1: icmp_seq=0 ttl=128 time=0.936 ms
    64 bytes from 192.168.255.1: icmp_seq=1 ttl=128 time=1.175 ms
    64 bytes from 192.168.255.1: icmp_seq=2 ttl=128 time=0.502 ms
    
    --- 192.168.255.1 ping statistics ---
    3 packets transmitted, 3 packets received, 0% packet loss
    round-trip min/avg/max = 0.502/0.871/1.175 ms
    

    Reference:
    https://portal.nutanix.com/page/documents/kbs/details?targetId=kA032000000CifmCAC

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleIncreasing the vSAN Datastore Capacity
    Next Article Installing Docker Engine on Debian
    Danilo

    Infrastructure Engineer with experience in Virtualization, Linux, Windows Server and learning automation using Python. DPC Virtual Tips was created to share practical tutorials, lab experiences and troubleshooting guides focused on enterprise infrastructure technologies.

    Related Posts

    How to Troubleshoot Packet Drops on an ESXi Host

    August 16, 2026

    VM Replication with vSphere Replication and Site Recovery Manager

    June 16, 2025

    Changing DNS Settings on ESXi Hosts

    May 20, 2025

    Comments are closed.

    Search
    Categories
    • HPC (12)
    • Operating Systems (85)
    • PowerFlex (22)
    • Virtualization (130)
    Read More
    Virtualization

    How to Troubleshoot Packet Drops on an ESXi Host

    By DaniloAugust 16, 20260
    HPC

    SlurmDBD Is Down: What Continues Working and What Does Not

    By DaniloAugust 15, 20260
    HPC

    How to Investigate Jobs Stuck in COMPLETING State on Slurm

    By DaniloAugust 14, 20260
    Operating Systems

    Linux Server Has Free Memory but Is Swapping: Why?

    By DaniloAugust 13, 20260
    Operating Systems

    How to Determine Whether Packet Loss Is Local or Network Related on Linux

    By DaniloAugust 12, 20260
    Latest Posts

    How to Troubleshoot Packet Drops on an ESXi Host

    August 16, 2026

    SlurmDBD Is Down: What Continues Working and What Does Not

    August 15, 2026

    How to Investigate Jobs Stuck in COMPLETING State on Slurm

    August 14, 2026
    Images from Gallery
    hpc main commands
    linux commands
    install rock linux
    lustre fs
    shell scripting
    vSAN Trace Files
    Categories
    • HPC
    • Operating Systems
    • PowerFlex
    • Virtualization
    • Home
    • About Us
    • Contact
    • Cookie Policy
    • Comment Policy
    • Privacy Policy
    • Terms of Use
    • Disclaimer
    Copyright © 2026, DPC Virtual Tips. All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.

    We use cookies to ensure your best experience on our website. If you continue using our website, we'll assume you agree to our cookie policy