Checking Connection without Telnet

Some of the minimal Linux distributions have no telnet client utility or similar utilities such as nc,ncat¬†unless you install it. Most of time we need to do troubleshooting to check connection if¬† server/service is accessible. Do not worry–You still have mechanism inside the Linux kernel without installing above utilities. Take a look at below examples and change it accordingly for your case.

Checking TCP connection:

root@debian2:# echo > /dev/tcp/8.8.8.8/53 && echo "PORT IS OPEN" || echo "PORT IS NOT OPEN"
PORT IS OPEN
root@debian2:~# echo > /dev/tcp/google.com/80 && echo "PORT IS OPEN" || echo "PORT IS NOT OPEN"
PORT IS OPEN
root@debian2:~# echo > /dev/tcp/google.com/443 && echo "PORT IS OPEN" || echo "PORT IS NOT OPEN"
PORT IS OPEN
#I have to send signal SIGINT.
root@debian2:~# echo > /dev/tcp/google.com/123 && echo "PORT IS OPEN" || echo "PORT IS NOT OPEN"
^C-su: connect: Network is unreachable


Checking UDP Connection:

root@debian2:~# echo > /dev/udp/0.pool.ntp.org/123 && echo "PORT IS OPEN" || echo "PORT IS NOT OPEN"
PORT IS OPEN