How to test the connections between Linux hosts/servers?

How to easily and quickly test the connection between two nodes on Linux? This should be specific to protocol and port.

We can use nc (netcat) to test the connection between two servers.

For example, to test whether TCP port 1048 can be used on the server (IP as an example) side:

On the server:

$ nc -l 1048

On the client

$ nc 1048

If it can connect to the server, type something into it. If the server can also see it, the connection has no problem.
For testing UDP connection, we can simply add the ‘-u’ option to nc:
On server:

$ nc -u -l 1048

On client:

$ nc -u 1048

To check the ports which have programs listening to:

$ netstat -putln

More using examples of nc in “TCP/IP connection testing with nc (netcat)”:

Leave a Reply

Your email address will not be published. Required fields are marked *