How to Ping Specific Port Number on Remote Host

neotam Avatar

How to Ping Specific Port Number on Remote Host
Posted on :

Tags :

In general to troubleshoot network connectivity ping command is used, where ping command uses the ICMP protocol behind the scenes. ICMP stands for Internet Control Message Protocol, it is used as complimentary protocol along with IP to send back error message or information about IP communication whether it is successful or not. When it comes to checking particular port is open or not ping command doesn’t work, since ICMP protocol works in network layer and port numbers are associated with TCP or UDP protocols of transport layer

To check whether particular port is open or not, there are other utilities such as

  • Telnet
  • Netcat(nc)
  • Network Mapper (nmap)

Ping a Specific Port Using Telnet

Telnet stands for Teletype network. It is the type of protocol also a tool, which is used as standard TCP/IP protocol virtual terminal service to connect to the remote computer using local computer. Telnet operates based on client/server architecture. Where, local computer uses the Telnet client program while remote computer uses the Telnet serve program. Telnet uses the TCP protocol and port number 23. Telnet can also used as generic client to connect with remote computer with any port if particular port is open and send/receive data according to protocol of connected port.

To ping the specific port or check if specific port on remote host is open. Connect to the remote host on specific port using telnet as follows

telnet <remote host address> <port number> 


telnet 80 

If port is open, telnet will be able to connect and you will see the prompt something like

$ telnet 80
Trying 2404:6800:4009:82e::200e...
Connected to
Escape character is '^]'.

If port is not open, telnet will not be able to connect. And, you can see Telnet is stuck with Trying message

$ telnet 89
Trying 2404:6800:4009:82e::200e...
telnet: connect to address 2404:6800:4009:82e::200e: Operation timed out


To quit from telnet, press the key combination CTRL + ] and then q command

Ping a Specific Port Using Netcat

Netcat (nc) is the tool that is designed to read and write data into network connections that use TCP or UDP Transport protocols using IP protocol suite. You can use Netcat as either client or server.

Install netcat on Debian machines as follows

sudo apt install netcat

To ping or connect to the specific port on remote host use the follow command

nc -vz <remote host address>  <port number> 


-z      Specifies that nc should just scan for listening daemons, without sending any data to them.  It is an error to use this option in conjunction with the -l option.
-v      Have nc give more verbose output.


nc -vz 80 


netcat -vz 80 

Note that: on some machine netcat command is also available as nc

Here is the case, where port number 80 is open for http

$ nc -vz 80
Connection to port 80 [tcp/http] succeeded!

If specified port is not open, netcat will result in timeout

$ nc -vz 89
nc: connectx to port 89 (tcp) failed: Operation timed out

Ping a Specific Port Using nmap

nmap is a great networking tool which is used for network discovery, vulnerability scanning where it can also be used to ping specific port number on remote host.

Install nmap on Debian based system

apt install nmap 

Command to ping specific port

nmap -p <port number <remote host address> 


nmap -p 80 

To ping range or ports

nmap -p 80-180

Nmap is very powerful tool, using nmap you can also ping specific port across the block or network of computers by specifying CIDR block

nmap -p 80 

Ping a Specific Port using Test-NetConnection on Windows Using PowerShell

To ping a specific port on windows platform using PowerShell, Test-NetConnection command is pretty helpful

Test-NetConnection <remote_host_address> -p <port_number> 


Test-NetConnection -p 80 

Leave a Reply

Your email address will not be published. Required fields are marked *