Check Network Availability

Check Network Availability

The following commands can be used to check if a remote host is available on the network.

Here is an example to check if port 22 on 192.168.21.32 is open.

Linux

1
2
3
4
5
6
7
8
nc -zv 192.168.21.32 22

# or
nmap -p 22 192.168.21.32

# or, if no output, port is open
timeout 1 bash -c 'cat < /dev/null > /dev/tcp/192.168.21.32/22'
echo >/dev/tcp/192.168.21.32/22

Windows

1
2
3
4
telnet 192.168.21.32 22

# or (PowerShell)
Test-NetConnection -ComputerName 192.168.21.32 -Port 22