Netcat is a utility for checking open ports. It has more flexibility than using the telnet command and can be used with scripts more easily. This is not a comprehensive tutorial, only a quick reference source. Consult the man pages and/or documentation for indepth explanation of commands.
nc -v www.google.com 80 # success Ncat: Version 6.40 ( http://nmap.org/ncat ) Ncat: Connected to 18.104.22.168:80.
UDP tests will always appear successful. You need to run tcp dump and/or check firewall sessions to confirm UDP ports.
nc -vu 22.214.171.124 53 # success ... maybe ? Check firewall sessions if dont have access to end host for TCPDUMP Ncat: Version 6.40 ( http://nmap.org/ncat ) Ncat: Connected to 126.96.36.199:53.
It's possible to start a 'listener'. This is great for testing through firewalls.
# TCP sudo nc -l 10.1.1.10 80 # UDP sudo nc -l 10.1.1.10 -u 53
Last Updated: 2017-09-27