Checking the availability of TCP / UDP ports on a remote machine

netcat – a Unix utility that allows you to establish TCP and UDP connections, receive data from there and transmit them. Despite its usefulness and simplicity, this utility is not included in any standard.

To check the availability of TCP / UDP ports on a remote machine, we will use the Netcat utility

Installation:

### CentOS
$ sudo yum install nc


### Debian / Ubuntu
$ sudo apt update
$ sudo apt install netcat

Under Windows, this utility is also available

Checking the TCP port

$ nc -zv 10.10.4.4 22
srv-app.local [10.10.4.4] 22 (ssh) open

Checking the UDP port

$ nc -uv 10.10.4.2 123
srv-dc01.local [10.10.4.2] 123 (ntp) open

Related Posts