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

CLN-1

To list all Standard vSwitch present on the Esxi host

CLN-2

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

CLN-3

CLN-4

Adding a new vSwitch to Esxi host

Adding a new vswitch with specific number of ports

CLN-5

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:

CLN-6

Create a new portgroup in a standard vswitch

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

CLN-7

Removing a portgroup from a vSwitch

Below command will delete a portgroup from a standard vswitch

CLN-7_2

Configuring CDP on Standard switches

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

# esxcli network vswitch standard set

CLN-8

To enable CDP on a vswitch

To disable CDP on a vswitch

CLN-9

Configuring uplinks for Standard vSwitch

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

# esxcli network vswitch standard uplink

CLN-10

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

CLN-11

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

CLN-12

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

CLN-14

Configuring failover policy

To set failover settings on a vswitch the command used is

# esxcli network standard vswitch policy failover set

CLN-13

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

CLN-15

To check the failover policies on a Portgroup

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

CLN-16

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”

CLN-17

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

CLN-18

To Set Traffic Shaping Policy

# esxcli network vswitch standard policy shaping set

The associated namespace are as follows

CLN-18_2

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

CLN-19

To check properties of a single vmknic

CLN-20

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

CLN-21

The command used for performing operations on a single vmnic is

# esxcli network nic

The associated namespace are

CLN-22

Shutdown a vmnic

To shutdown vmnic on your Esxi host the command is

CLN-23

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

CLN-24

To reconnect a vmnic

The command used for bringing up a vmnic again is

CLN-25

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:

CLN-26

CLN-27

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:

CLN-28

Checking the ARP table of your Esxi host

The command used for this purpose is

CLN-29

DNS server settings

The parent command for DNS related settings is

And the associated namespace are:

CLN-30

List all the DNS servers configured on your Esxi host

CLN-31

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:

CLN-32

Checking the current status of routing table of your Esxi host

CLN-33

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

CLN-34

Configuring Esxi firewall settings

The parent command used for configuring firewall related settings is

# esxcli network firewall

Associated namespace are as follows:

CLN-35

CLN-36

To check the current firewall settings

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

CLN-37

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: Virtual Reality

Leave a Reply