Last Updated: January 15, 2021
· rodnaph

Netcat to Test Connectivity

Need to test port connectivity between two hosts? Netcat to the rescue! Start the server on one host (port 1234 in this example)...

nc -l 1234

Then connect to it from the other host...

nc server-name 1234

Hopefully nothing should happen, but now anything you type into either end will be relayed to the other, showing the connection is ok.

3 Responses
Add your response

Useful, thanks!

over 1 year ago ·

If you want to log UDP specifically, try nc -lu 1234

over 1 year ago ·

You can use the flag "-z" that closes the connection right after a successful attempt...

over 1 year ago ·