One of the testing tools for VMware networking is netcat. We have a post which explains the basics of vmkping command here – How To Test Network Connectivity with a vmkping command in VMware environments. Check it out. Today's post is called How To Test Network Connectivity with netcat utility in VMware environments and we'll explore some possibilities we have with netcat.
Netcat is used to verify connectivity on a specific remote port(s). This command is especially useful in environments where you have a firewall between vCenter and ESXi host or between each ESXi host(s).
Netcat can do much more than that, but we'll focus mainly on the use for VMware environments, where we want to check connectivity with a remote host at a particular port. It can be for example a vMotion port 8000 which we want to test.
Netcat Definition:
nc is the command which runs netcat, a simple Unix utility that reads and writes data across network connections, using the TCP or UDPprotocol. It is designed to be a reliable “back-end” tool that can be used directly or driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities.
Source link
As you can see, it's a command with multiple possibilities. Let's have a look at the syntax and how to get help.
We will have a look at the syntax of the netcat command for open ports:
nc -z destination_ip destination_port
Example:
nc -z 10.10.4.21 443
it will test if the remote host at 10.10.4.21 can be reached at port 443
You can also test multiple ports or range.
Range, for example:
nc -z 10.10.4.21 443-9443
Multiple ports, for example:
nc -z 10.10.4.21 80 443 9443
You can also add a timeout value:
-w (wait)
Example:
nc -w 1 -z 10.10.4.21 443-480
Netcat can do more than that. You can
How to Get Help?
Example:
nc -h
easy….
There are quite a lot of port open, for incoming or outgoing communications, on VMware ESXi. To know them all? It depends which services are configured within your environment. Whether you have a vMotion activated, you'll certainly want to check port 8000.
Whether you need to check communication for VSAN transport service, you'd want to check connection through the port 2233. And so on, so the best is to check Incoming and Outgoing Firewall Ports for ESXi Hosts VMware documentation page.
Most popular VMware vSphere Editions for Small business
Differences between Essentials and Essentials PLUS below. As you can see Essentials does not have High Availability (automatic VM restart), vMotion, backup software (VDP) or possibility to add VSAN as shared storage option (separate licensing option – per physical CPU).
The vSphere Essentials is good for very small clients and clients who do not really need availability. Clients which can afford to stay “offline” for a day while doing hardware maintenance.
On the other hand, having the possibility to migrate your VMs to another host and do host maintenance or patching, without interruption, gives you a real advantage. This can be done during business hours and users can continue to work.
You'll need vSphere Essentials Plus for that. If there is an unplanned hardware failure, vSphere High Availability (HA) can restart automatically those VMw which failed when the host failed. Those VMs are automatically restarted on other hosts which are part of VMware cluster. There is small downtime during which the system figures out what the host has failed and which are the hosts that are able to start the failed VMs. Once this automatic decision is taken, the VM boots up. The whole process is completely automatic and acts without the admin’s intervention.
Both above are limited to 3 Hosts only. If you need more VMs and more hosts, the vSphere Standard is your choice.
vSphere Tips:
More ESXi CLI commands:
- ESXi CLI Networking commands
- ESXi Commands List – Getting Started
- ESXi Commands List – Snapshot Deletion Monitoring
- ESXi Commands List – Storage
More from ESX Virtualization
- What is VMware vMotion?
- How to Patch vCenter Server Appliance (VCSA) – [Guide]
- VCP6.5-DCV Objective 7.1 – Troubleshoot vCenter Server and ESXi Hosts
- Free Tools VMware
- How To Upgrade ESXi 6.x to 6.7 via ISO
- VMware Tools Offline VIB for ESXi Host – Bundle Download and Install
- What is ESXi Compatibility Checker?
Stay tuned through RSS, and social media channels (Twitter, FB, YouTube)
Mirek says
Thanks. Btw, small typo:
it will test if the remote host at 10.10.4.13 can be reached at port 443 –> should be it will test if the remote host at 10.10.4.21 can be reached at port 443 😉
Vladan SEGET says
Diky za korekci -:) Thanks for the correction.
Arun Kumar says
Hello Vladan,
I am Running (nc -z targetip port) command on ESXi 6.5 but, it is neither giving any error nor success message. The cusrsor returns to its prompt without any message.
Apart from nc is there any other command i can use to test the port on ESXi host
Could you help where am i doing wrong.
Mike Schreiner says
I get the exact same thing. it goes back to the prompt.