Netstat is a classic tool available in almost all operating systems and can display the listening ports as well as the state of TCP sessions. This is often very useful to be able to note if a correct TCP three-way handshake has been setup to some remote server or if a local service is listening to a certain port.
The command in ESXi 5.0 to emulate netstat is:
esxcli network ip connection list
(On ESXi 4.1 the command line was “esxcli network connection list“.)
You could then use filters on the output with “grep”. Use any keyword to search for and include the -i switch for non-case sensitive. For example, to display all listening ports in the hypervisor use:
esxcli network ip connection list | grep -i listen
To verify that the local iSCSI initiator has been able to connect to a certain iSCSI SAN we could filter for the TCP/3260 (default port for iSCSI Target) :
esxcli network ip connection list | grep 3260
In the picture above we can see that the ESXi host has an established connection to the iSCSI SAN with IP address 192.168.100.10.
Another common command found on most TCP/IP implementations is “arp“, which displays the mappings between layer three IP addresses and layer two MAC addresses. The arp command itself is missing in ESXi, but there is also a very similar option available in esxcli.
To get the ESXi version of “arp -a” you could use:
esxcli network ip neighbor list
(Command line in ESXi 4.1 was “esxcli network neighbor list“.)