10 Virtual Networking Commands Every vSphere Admin Needs To Know

 

esxcfg-nics-h

 

10 Virtual Networking Commands every vSphere Admin needs to know

In this blog, I’ll be sharing few of the Virtual Networking commands widely used by VMware Administrators/Engineers to configure, manage & troubleshoot networking issues in vSphere Environment.

VMware is having two different CLIs called esxcfg-* and esxcli network * for managing and configuring ESXi Networking.

It would be difficult to capture all these commands in single post so I have divided this post in multiple series.

In this Part-1, we are going to discuss about esxcfg-nics and esxcfg-vswitch API to retrieve info about vSwitch and NIC cards installed on ESXi Host.

Make sure you have SSH enabled on ESXi Host so that host can be accessed through PUTTY. I found putty interface more useful than ESXi shell to navigate through esxcli or esxcfg-* commands.

Let’s first start with ESXCFG-* command line Interface:

 

NETWORKING COMMAND NO:1

Getting information about the Physical Uplinks or NICs

 

esxcfg-nics -l

This command is very useful to retrieve information about Network Cards installed on ESXi Host.

Name: This field gives info about how esxi kernel has enumerated or identified network uplinks. Since vmkernel indexing is based on Array indexing so it always start from 0.

PCI : It gives PCI device info like Bus, Device and Function Id of each uplink ports/NIC ports.

Driver: It gives Network driver information for uplink ports/NIC ports.

Link: It gives link status info of ESXi Uplinks:

  • If Link status is Down then Uplink is not operational. There could be many reasons for uplink to go down like cable is not connected to uplink port, switch port is down etc.
  • If Link status is UP then Uplink is operational and could be mapped to vSwitch for forwarding virtual machine traffic.

Speed:  It gives speed information like 1G, 10G, 100mbps etc. of uplink ports.

Duplex: It gives duplex info of these uplinks

MAC address: This field gives MAC address information of ESXi uplinks

MTU: It gives MTU information of uplinks. Default MTU is 1500 bytes

Description: It gives vendor and card model information of NIC cards.

 

Explanation of this Output:

This command output shows that:

  • This ESXi Host is having Quad Port 1G Broadcom Network card
  • Model name of this Card is Netextreme BCM5719 Gigabit Ethernet Adpater
  • Out of 4 Ports, 2 Ports are operational and 2 Ports are down.
  • Operational MAC addresses are 40:f2:e9:ba:30:e8 & 40:f2:e9:ba:30:e9.
  • vSwitch with uplink requirement has to be configured with either vmnic0 or vmnic1.

Esxcfg-nics  API also used to set the SPEED and DUPLEX Mode of the NIC

esxcfg-nics -h help will get you through options which can be configured through this API

esxcfg-nics-h

 

SETTING UP SPEED AND DUPLEX MODE:

Command to setup NIC Card with 100mbps and Half Duplex Mode:

~ # esxcfg-nics  -s 100 -d half  vmnic0

 

esxcfg-nics-s

Let’s try to configure Card Speed back to 1000mbps and Full Duplex Mode.

 

s1000-dFull

As per error message mentioned above, it clarifies that setting higher speed using -s option is not supported on uplink so ESXi Kernel allows setting higher speed using auto-negotiation option.
This auto-negotiation option decides whether to use either full duplex or half duplex based on the network the Ethernet device attached to.

 

NETWORKING COMMAND NO:2

GETTING INFORMATION ABOUT VSWITCH AND ITS CONFIGURATION

 

esxcfg-vswitchOutput

This command is very helpful to see how many portgroups are created on vSwitch, which uplink is configured for vSwitch traffic.

SwitchName : This field shows vSwitch Name enumerated by Vmkernel.

Num Ports – This field gives default no of virtual ports configured on vSwitch0

Used Ports – No of virtual ports currently in use

Configured Ports – No of ports currently configured for IO traffic

MTU – vSwitch is configured with default MTU size 1500 Bytes

Uplinks – vmnic0 is used as Uplink for vSwitch Traffic

Portgroup Name – vSwitch0 is configured with two portgroups

  • VM Network – Default portgroup created for Virtual Machine Traffic
  • Management Network – Default portgroup created for Vmkernel Traffic

VLAN ID – This field shows VLAN configured on vSwitch. Currently there is no VLAN configured on vSwitch

Used Ports – This field shows 3 virtual ports are currently being used by Virtual Machines and 1 Port is being used by Vmkernel

Uplinks – Virtual Machine and Vmkernel traffic configured with uplink vmnic0 to communicate with external network.

 

Explanation of this Output:

This output shows that vSwitch0 is configured on ESXi Host having two portgroups:

  • VM Network – 3 Virtual Machines currently using virtual ports on this vSwitch.
  • Management Network – 1 Vmkernel NIC currently using virtual ports on this vSwitch.
  • Currently No VLAN configured on this vSwitch
  • vmnic0 is used as uplink to communicate with external network.
  • MTU configured on vSwitch is 1500 Bytes (Default MTU Size)

esxcfg-vswitch CLI becomes very handy and useful during vSwitch Troubleshooting and Configuration issues.

Esxcfg-vswitch -h help option will show numerous operations which can be performed through this CLI.

For ex:

  • Creating Virtual Switch
  • Adding portgroups
  • Adding VLANs
  • Assigning Uplink to vSwitch
  • Configuring MTU
  • Listing vSwitch configuration

CHECK OUT BELOW VIDEO ON VIRTUAL NETWORKING COMMANDS

 

I hope you guys might have found this article useful and knowledgeable.
Please share your feedback and feel free to post your queries. I would be glad to answer it.

KEEP SHARING, KEEP LEARNING!!!

You May Also Interested In

govmlab on sabtwittergovmlab on sablinkedingovmlab on sabgooglegovmlab on sabfacebookgovmlab on sabemail
I am VMware Solution Architect with 10+ Years of enriching experience in Datacenter Virtualization Technologies, Storage Area Networks and Software Defined Datacenter, Networking and Storage.
I hold Numerous certification including RHCE, CCNA, VCP4.0, VCP5.1, VCP5.5, vCloud and EMC certification.
While spending countless hours exploring the product inside and out and learning everything about it, Eventually I discovered my passion for teaching and helping others learn from my knowledge and experience so turned to Trainer cum Blogger to educate every single person keen to learn Virtualization.

Leave a Reply