Posted in: Unix, VMware

Important ESXi Networking Commands

To get the available virtual switches information on ESXi host :-

# esxcfg-vswitch -l

[root] esxcfg-vswitch -l
Switch Name Num Ports Used Ports Configured Ports MTU Uplinks
vSwitch0 6656 4 128 9000 vmnic3

PortGroup Name VLAN ID Used Ports Uplinks
VM Network 0 0 vmnic3
Management Network 4095 1 vmnic3

DVS Name Num Ports Used Ports Configured Ports MTU Uplinks
vDSwitch1 6656 5 512 9000 vmnic1

DVPort ID In Use Client
30 1 vmnic1
31 0
28 1 vmk1
29 1 vmk2

To get the available Network cards on ESXi host :-

# esxcfg-nics -l
[root] esxcfg-nics -l
Name PCI Driver Link Speed Duplex MAC Address MTU Description
vmnic0 0000:01:00.0 ixgben Down 0Mbps Half 24:6e:96:09:f3:08 1500 Intel Corporation Ethernet Controller 10 Gigabit X540-AT2
vmnic1 0000:01:00.1 ixgben Up 10000Mbps Full 24:6e:96:09:f3:0a 9000 Intel Corporation Ethernet Controller 10 Gigabit X540-AT2
vmnic2 0000:08:00.0 igbn Up 1000Mbps Full 24:6e:96:09:f3:0c 1500 Intel Corporation Gigabit 4P X540/I350 rNDC
vmnic3 0000:08:00.1 igbn Up 1000Mbps Full 24:6e:96:09:f3:0d 9000 Intel Corporation Gigabit 4P X540/I350 rNDC

To get the available vmkernel portgroups on ESXi host :-

# esxcfg-vmknic -l
[root] esxcfg-vmknic -l
Interface Port Group/DVPort/Opaque Network IP Family IP Address Netmask Broadcast MAC Address MTU TSO MSS Enabled Type NetStack
vmk0 Management Network IPv4 10.27.10.102 255.255.252.0 10.27.11.255 24:6e:96:09:f3:0d 1500 65535 true STATIC defaultTcpipStack
vmk0 Management Network IPv6 fe80::266e:96ff:fe09:f30d 64 24:6e:96:09:f3:0d 1500 65535 true STATIC, PREFERRED defaultTcpipStack
vmk1 28 IPv4 192.168.9.102 255.255.255.0 192.168.9.255 00:50:56:6f:70:2b 9000 65535 true STATIC defaultTcpipStack
vmk1 28 IPv6 fe80::250:56ff:fe6f:702b 64 00:50:56:6f:70:2b 9000 65535 true STATIC, PREFERRED defaultTcpipStack
vmk2 29 IPv4 192.168.10.102 255.255.255.0 192.168.10.255 00:50:56:69:b0:7b 9000 65535 true STATIC defaultTcpipStack
vmk2 29 IPv6 fe80::250:56ff:fe69:b07b 64 00:50:56:69:b0:7b 9000 65535 true STATIC, PREFERRED defaultTcpipStack

To list current vswitch configuration :-

# esxcli network vswitch standard list
[root] esxcli network vswitch standard list
vSwitch0
Name: vSwitch0
Class: cswitch
Num Ports: 6656
Used Ports: 4
Configured Ports: 128
MTU: 9000
CDP Status: listen
Beacon Enabled: false
Beacon Interval: 1
Beacon Threshold: 3
Beacon Required By:
Uplinks: vmnic3
Portgroups: VM Network, Management Network

To list Distributed Switch configuration :-

# esxcli network vswitch dvs vmware list
[root] esxcli network vswitch dvs vmware list
vDSwitch1
Name: vDSwitch1
VDS ID: 50 12 e0 73 4a ec 9f 50-38 b6 89 6e 28 0f e4 4d
Class: cswitch
Num Ports: 6656
Used Ports: 5
Configured Ports: 512
MTU: 9000
CDP Status: both
Beacon Timeout: -1
Uplinks: vmnic1
VMware Branded: true
DVPort:
Client: vmnic1
DVPortgroup ID: dvportgroup-22
In Use: true
Port ID: 30

To list vmkernel interfaces and their configuration :-

# esxcli network ip interface list
[root] esxcli network ip interface list
vmk0
Name: vmk0
MAC Address: 24:6e:96:09:f3:0d
Enabled: true
Portset: vSwitch0
Portgroup: Management Network
Netstack Instance: defaultTcpipStack
VDS Name: N/A
VDS UUID: N/A
VDS Port: N/A
VDS Connection: -1
Opaque Network ID: N/A
Opaque Network Type: N/A
External ID: N/A
MTU: 1500
TSO MSS: 65535
RXDispQueue Size: 1
Port ID: 33554436

To display listing of physical adapters and their link state :-

# esxcli network nic list
[root] esxcli network nic list
Name PCI Device Driver Admin Status Link Status Speed Duplex MAC Address MTU Description
—— ———— —— ———— ———– —– —— —————– —- ———————————————————
vmnic0 0000:01:00.0 ixgben Up Down 0 Half 24:6e:96:09:f3:08 1500 Intel Corporation Ethernet Controller 10 Gigabit X540-AT2
vmnic1 0000:01:00.1 ixgben Up Up 10000 Full 24:6e:96:09:f3:0a 9000 Intel Corporation Ethernet Controller 10 Gigabit X540-AT2
vmnic2 0000:08:00.0 igbn Up Up 1000 Full 24:6e:96:09:f3:0c 1500 Intel Corporation Gigabit 4P X540/I350 rNDC
vmnic3 0000:08:00.1 igbn Up Up 1000 Full 24:6e:96:09:f3:0d 9000 Intel Corporation Gigabit 4P X540/I350 rNDC

To list ARP table on ESXi host :-
# esxcli network ip neighbor list

[root] esxcli network ip neighbor list
Neighbor Mac Address Vmknic Expiry State Type
————– —————– —— ——– —– ——-
10.27.11.254 58:8d:09:ee:68:80 vmk0 1183 sec Unknown
192.168.9.103 00:50:56:69:93:6e vmk1 510 sec Unknown
192.168.9.105 00:50:56:6b:5d:3a vmk1 510 sec Unknown
192.168.9.104 00:50:56:67:66:76 vmk1 510 sec Unknown
192.168.10.103 00:50:56:60:71:df vmk2 399 sec Unknown
192.168.10.104 00:50:56:63:ae:6b vmk2 430 sec Unknown
192.168.10.105 00:50:56:60:56:9e vmk2 1017 sec Unknown
192.168.10.254 50:eb:1a:f3:3a:07 vmk2 190 sec Unknown

Netstat equivalent command on ESXi host :-
# esxcli network ip connection list

[root] esxcli network ip connection list
Proto Recv Q Send Q Local Address Foreign Address State World ID CC Algo World Name
—– —— —— ——————————— ——————– ———– ——– ——- —————————-
tcp 0 0 127.0.0.1:8307 127.0.0.1:41932 ESTABLISHED 2100233 newreno hostd-IO
tcp 0 943 127.0.0.1:41932 127.0.0.1:8307 ESTABLISHED 2100378 newreno rhttpproxy-work
tcp 0 0 127.0.0.1:80 127.0.0.1:60403 ESTABLISHED 2100242 newreno rhttpproxy-IO
tcp 0 0 127.0.0.1:60403 127.0.0.1:80 ESTABLISHED 6691346 newreno python
tcp 0 0 127.0.0.1:61978 127.0.0.1:9095 TIME_WAIT 0

To check LACP stats :-

# esxcli network vswitch dvs vmware lacp stats get

[root] esxcli network vswitch dvs vmware lacp stats get
No running LACP group on the host.

To get all stats on vmnics :-

# esxcli network nic stats get -n vmnic0

[root] esxcli network nic stats get -n vmnic0
NIC statistics for vmnic0
Packets received: 0
Packets sent: 0
Bytes received: 0
Bytes sent: 0
Receive packets dropped: 0
Transmit packets dropped: 0
Multicast packets received: 0
Broadcast packets received: 0
Multicast packets sent: 0
Broadcast packets sent: 0
Total receive errors: 0
Receive length errors: 0
Receive over errors: 0
Receive CRC errors: 0
Receive frame errors: 0
Receive FIFO errors: 0
Receive missed errors: 0
Total transmit errors: 0
Transmit aborted errors: 0
Transmit carrier errors: 0
Transmit FIFO errors: 0
Transmit heartbeat errors: 0
Transmit window errors: 0