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 10.0.3.48 as an example) side:

On the server:

$ nc -l 1048

On the client

$ nc 10.0.3.48 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 10.0.3.48 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)”: http://www.xinotes.org/notes/note/1080/

Answered by SA.

Leave a Reply

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