Checking Open Ports Manually Using the Netcat Utility

Once your cluster is up and running, you can check ports manually through the command line using the netcat (nc) utility. What follows is an example using the utility to check ports.

Before performing the procedure, choose the private IP addresses of two nodes in your cluster.

The examples given below use nodes with the private IPs:

10.0.11.60 10.0.11.61 

Install the nc utility on your nodes. Once installed, you can issue commands to check the ports on one node from another node.

  1. To check a TCP port:

    1. Put one node in listen mode and specify the port. In the following sample, we’re putting IP 10.0.11.60 into listen mode for port 4804.

      [root@ip-10-0-11-60 ~]# nc -l 4804
    2. From the other node, run nc specifying the IP address of the node you just put in listen mode, and the same port number.

      [root@ip-10-0-11-61 ~]# nc 10.0.11.60 4804
    3. Enter sample text from either node and it should show up on the other. To cancel once you have checked a port, enter Ctrl+C.

    Note: To check a UDP port, use the same nc commands with the –u option.

    [root@ip-10-0-11-60 ~]# nc -u -l 4804
    [root@ip-10-0-11-61 ~]# nc -u 10.0.11.60 4804