Use netcat (nc) to check if a remote port is reachable

Netcat (nc) can be use to check if a remote port is reachable and client can connect to it. The following commands were tried on Mac and Ubuntu Linux.

Checking tcp port

Use -t (tcp), -v (verbosity) and -z (to scan the port without sending any data).

$ nc -tvz google.co.in 80
found 0 associations
found 1 connections:
     1:	flags=82
	outif en1
	src 192.168.100.103 port 57068
	dst 216.58.197.35 port 80
	rank info not available
	TCP aux info available

Connection to google.co.in port 80 [tcp/http] succeeded!

Checking udp port

$ nc -uvz google.co.in 80
found 0 associations
found 1 connections:
     1:	flags=82
	outif (null)
	src 192.168.100.103 port 64555
	dst 216.58.197.67 port 80
	rank info not available

Connection to google.co.in port 80 [udp/http] succeeded!
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments