I: Install telnet netcat
I.a: Install telnet netcat on Linux:
yum install nc -y yum install telnet -y
I.b: Install telnet netcat on Windows:
How to install netcat on Windows
How to install telnet client on Windows Server 2008
II: Checking TCP port connectivity
II.a: Checking TCP port connectivity with telnet
telnet hostname/IP-address port-number
Example successful connection:
C:\Users\Administrator>telnet 127.0.0.1 11211
Example unsuccessful connection:
C:\Users\Administrator>telnet 127.0.0.1 22 Connecting To 127.0.0.1...Could not open connection to the host, on port 22: Con nect failed
II.b: Checking TCP port connectivity with netcat
nc -z -v hostname/IP-address port-number
Example successful connection:
$ nc -z -v 127.0.0.1 11211 Connection to 127.0.0.1 11211 port [tcp/*] succeeded!
Example unsuccessful connection:
$ nc -z -v 127.0.0.1 81 nc: connect to 127.0.0.1 port 81 (tcp) failed: Connection refused
III: Checking UDP port connectivity (by netcat)
nc -z -v -u hostname/IP-address port-number
Example successful connection:
$ nc -z -v -u 192.168.1.27 4444 Connection to 192.168.1.27 4444 port [udp/*] succeeded!
Check UDP server we see:
Data received from client : X Received 1 bytes from 192.168.1.27:50394