VMware Arena

ESXi5 Command Line Reference – Networking Part 2

This post covers the creation,modification and deletion of virtual switches,distributed virtual switches  and Port Group etc using the command esxcli network vswitch. under switch options it has 2 available options. dvs is for distributed virtual switch and standard for standard virtual switch.

Please refer ESXi5 Command Line Reference – Networking Part 1 for better understanding.

~ # esxcli network vswitch

We will concentrate on standard switch options one by one. Standard switch command has number of subcommands under it to perform different types of opertaions at various levels at virtual switch,uplink,port group ,security policy and traffic shaping. Let’s have a detailed look at it.

1. Virtual Switch Settings

~ # esxcli network vswitch standard

1.1 To list the virtual switches configured on the ESXi host.

~ # esxcli network vswitch standard list
vSwitch0
   Name: vSwitch0
   Class: etherswitch
   Num Ports: 128
   Used Ports: 3
   Configured Ports: 128
   MTU: 1500
   CDP Status: listen
   Beacon Enabled: false
   Beacon Interval: 1
   Beacon Threshold: 3
   Beacon Required By:
   Uplinks: vmnic0
   Portgroups: VMOTION, VM Network, Management Network

1.2 To add a new virtual switch called “vSwitch1” to the ESXi host

~ # esxcli network vswitch standard add -v vSwitch1
~ # esxcli network vswitch standard list
vSwitch0
   Name: vSwitch0
   Class: etherswitch
   Num Ports: 128
   Used Ports: 3
   Configured Ports: 128
   MTU: 1500
   CDP Status: listen
   Beacon Enabled: false
   Beacon Interval: 1
   Beacon Threshold: 3
   Beacon Required By:
   Uplinks: vmnic0
   Portgroups: VMOTION, VM Network, Management Network

vSwitch1
   Name: vSwitch1
   Class: etherswitch
   Num Ports: 128
   Used Ports: 1
   Configured Ports: 128
   MTU: 1500
   CDP Status: listen
   Beacon Enabled: false
   Beacon Interval: 1
   Beacon Threshold: 3
   Beacon Required By:
   Uplinks:
   Portgroups:

1.3 To set the MTU size and CDP status of a virtual switch “vSwitch1”

~ # esxcli network vswitch standard set -c listen -m 1500 -v vSwitch1

1.4 To remove the vSwitch called vSwitch1 from esxi host

~ # esxcli network vswitch standard remove -v vSwitch1

2. Virtual Switch Policy configuration

 To configure security,failover & shaping policy use the below commands

~ # esxcli network vswitch standard policy

2.1 Configure Failover policy for Virtual Switch

 # esxcli network vswitch standard policy failover

2.1.1 To get the failover policy of virtual switch called “vSwitch0”

~ # esxcli network vswitch standard policy failover get -v vSwitch0
   Load Balancing: srcport
   Network Failure Detection: link
   Notify Switches: true
   Failback: true
   Active Adapters: vmnic0
   Standby Adapters:
   Unused Adapters:
~ #

2.1.2 To set the failover policy of virtual switch called “vSwitch0”

~ # esxcli network vswitch standard policy failover set

~ # esxcli network vswitch standard policy failover set -a vmnic0,vmnic1  -b true -f link -l explicit -n true -s vmnic2 -v vSwitch0



2.2 Configure security policy for Virtual Switch

2.2.1 To get the security policy of virtual switch called “vSwitch0”

~ # esxcli network vswitch standard policy security get -v vSwitch0
   Allow Promiscuous: false
   Allow MAC Address Change: true
   Allow Forged Transmits: true

2.2.2 To set the security policy of Virtual switch Called “vSwitch1”

~ # esxcli network vswitch standard policy security set

~ # esxcli network vswitch standard policy security set -f true -m false -p true -v vSwitch0

~ # esxcli network vswitch standard policy security get -v vSwitch0
   Allow Promiscuous: true
   Allow MAC Address Change: false
   Allow Forged Transmits: true

2.3 Configure traffic shaping policy for Virtual Switch

2.3.1 To get traffic shaping policy

~ # esxcli network vswitch standard policy shaping get -v vSwitch0
   Enabled: false
   Average Bandwidth: -1 Kbps
   Peak Bandwidth: -1 Kbps
   Burst Size: -1 Kib

2.3.2 To set traffic shaping policy

~ # esxcli network vswitch standard policy shaping set -e true  -b 10000 -t 102000 -k 10000 -v vSwitch0

3. Configure Port Group for ESXi

~ # esxcli network vswitch standard portgroup

3.1 To list the available port group of ESXi host

~ # esxcli network vswitch standard portgroup list

Name                Virtual Switch  Active Clients  VLAN ID
——————  ————–  ————–  ——-
Management Network  vSwitch0                     1        0
VM Network          vSwitch0                     0        0

3.2 To add a port group called “VMOTION” in the virtual switch “vSwitch0”

~ # esxcli network vswitch standard portgroup add -p VMOTION -v vSwitch0

~ # esxcli network vswitch standard portgroup list
Name                Virtual Switch  Active Clients  VLAN ID
——————  ————–  ————–  ——-
Management Network  vSwitch0                     1        0
VM Network          vSwitch0                     0        0
VMOTION             vSwitch0                     0        0

3.3 To set VLAN ID for the port group

~ # esxcli network vswitch standard portgroup set -p VMOTION -v 15

~ # esxcli network vswitch standard portgroup list
Name                Virtual Switch  Active Clients  VLAN ID
——————  ————–  ————–  ——-
Management Network  vSwitch0                     1        0
VM Network          vSwitch0                     0        0
VMOTION             vSwitch0                     0       15

3.4 To remove port group called “VMOTION” from virtual switch “vSwitch0”

~ # esxcli network vswitch standard portgroup remove -p VMOTION -v vSwitch0

4. To configure Uplink for ESXi host

~ # esxcli network vswitch standard uplink

4.1 To add a uplink called “vmnic3” into virtual switch “vSwitch0”

~ # esxcli network vswitch standard uplink add -u vmnic3 -v vSwitch0

4.2 To remove a uplink called “vmnic3” from virtual switch “vSwitch0”

~ # esxcli network vswitch standard uplink remove -u vmnic3 -v vSwitch0

~ # esxcli network vswitch
Usage: esxcli network vswitch {cmd} [cmd options]

Available Namespaces:
  dvs                   Commands to retrieve Distributed Virtual Switch information
  standard              Commands to list and manipulate Legacy Virtual Switches on an ESX host.

~ # esxcli network vswitch dvs
Usage: esxcli network vswitch dvs {cmd} [cmd options]

Available Namespaces:
  vmware                Commands to retrieve VMware vSphere Distributed Switch information

~ # esxcli network vswitch dvs vmware list
~ #

Since we don’t have distributed virtual switch configured in our ESXi host. It is not listing anything under list commands. Will concentrate about dvs on upcoming post.

Thanks for Reading !!!. Please help us to grow by sharing the post in social media using below sharing option.

Exit mobile version