Managing vSphere Network From Command Line

Managing vSphere Standard Switch

Esxcli network vswitch command is used to do the networking configuration of a vswitch (Standard or vDS). The available namespace with this command are: standard and dvs as shown below

To list all Standard vSwitch present on the Esxi host

Add Remove vSphere Standard Switch

We can add/remove new standard switches or create a new portgroup in vswitch or associate uplinks to vswitch using the command

# esxcli network vswitch standard

The namespaces associated with the above command as shown below

Adding a new vSwitch to Esxi host

Adding a new vswitch with specific number of ports

Note: By default when a vSwitch is created it is created with 128 ports

Configuring Port Group on Standard Switches

Port groups are configured on vSwitch using the command

# esxcli network vswitch standard portgroup

The associated namespace with this command are as shown below:

Create a new portgroup in a standard vswitch

The following command is used to create a new portgroup on a standard vSwitch

Removing a portgroup from a vSwitch

Below command will delete a portgroup from a standard vswitch

Configuring CDP on Standard switches

Configuring CDP settings or MTU on a standard vswitch is done using the command :

# esxcli network vswitch standard set

To enable CDP on a vswitch

To disable CDP on a vswitch

Configuring uplinks for Standard vSwitch

The command used to add/remove uplinks to a standard vSwitch is

# esxcli network vswitch standard uplink

Adding an uplink to an existing vSwitch

The above command will add a new uplink vmnic1 to the vswitch1

Removing an existing uplink from a vSwitch

Setting Failover/Security/Traffic shaping policy configuration on a standard vSwitch

The command used to configure the policies on a standard vswitch is

# esxcli network vswitch standard policy

The available namespace with this command are shown below

Checking the configured policy (Failover/Security/Traffic Shaping) on a standard vSwitch

For e.g: command used to check the failover settings on a vSwitch are

similarly we can check security settings and traffic shaping settings on a vswitch

Configuring failover policy

To set failover settings on a vswitch the command used is

# esxcli network standard vswitch policy failover set

set command is used to apply the configuration settings available under failover policy

To check the failover policies on a Portgroup

get command is used to check the configured failover policy on a port group

Configuring Security Policy on standard vSwitch

The command used to set security policy on a vSwitch is

# esxcli network vswitch standard policy security

and the available namespace are “set and get”

set command is used to apply the settings available under security option like forged transmit or allowing promiscuous mode

To Set Traffic Shaping Policy

# esxcli network vswitch standard policy shaping set

The associated namespace are as follows

To list all the NICS present in Esxi host

The command used to see all the vmnics present on an Esxi host and their associated properties like link status, duplex speed, MTU value and Mac Address etc is

To check properties of a single vmknic

For troubleshooting purposes, you can view statistics for a given NIC by running:

The command used for performing operations on a single vmnic is

# esxcli network nic

The associated namespace are

Shutdown a vmnic

To shutdown vmnic on your Esxi host the command is

After running the above command verify from your vCenter server console whether nic is disconnected or not

To reconnect a vmnic

The command used for bringing up a vmnic again is

Checking TCP Segmentation offload and Checksum offload settings of vmnics

TCP segmentation offload and checksum offload are the techniques of network optimization where some of the network related tasks are offloaded to cpu of physical adapter. Not all the adapters support this feature but if it is supporting then we should enable it to get the most out of our physical adapters

The commands used for this purpose are:

Checking DNS server settings, Routing Table, ARP table and firewall settings

The parent command used for all these purpose is:

# esxcli network ip

The associated namespace are as follows:

Checking the ARP table of your Esxi host

The command used for this purpose is

DNS server settings

The parent command for DNS related settings is

And the associated namespace are:

List all the DNS servers configured on your Esxi host

Configuring and Modifying Routing Table of your Esxi host

The parent command used for configuring routing table is

# esxcli network ip route

The associated namespaces are shown as below:

Checking the current status of routing table of your Esxi host

To add a new route to your Esxi host

The command to add a new route in your host is

# esxcli network ip route ipv4 add –n=network_add –g=gateway address

Configuring Esxi firewall settings

The parent command used for configuring firewall related settings is

# esxcli network firewall

Associated namespace are as follows:

To check the current firewall settings

This command will list what are the services that are allowed/not allowed to pass through Esxi firewall

For exploring more command line options follow the below links:

vSphere Command-Line Interface Reference

Configuring vSwitch or vNetwork Distributed Switch from the command line

Hit Like and share this post on social media if the above post is informational to you. Happy Learning!!!

5 thoughts on “Managing vSphere Network From Command Line

  1. Pingback: Configuring Port Binding Using CLI | Go Virtual.

  2. Pingback: Virtual Reality

  3. Pingback: VCAP6-DCV Deploy Study Guide – Virtual Reality

Leave a ReplyCancel reply