Ping is a networking utility used to test the reachability and round-trip time (RTT) delay of a remote host over Internet Protocol (IP). The ping utility does so by sending out a series of Internet Control Message Protocol (ICMP) echo request packets to a remote host and waiting for corresponding ICMP response packets from the host.
However, we cannot check a specific port with ping command as ICMP belongs to the layer-2 IP layer, not layer-3 transport layer.
In order to ping a specific port of a remote host, we need to use layer-3 transport protocols which have a notion of port numbers.
There are many methods to check. Among them, the easiest methods are shown below.
Method I:
nmap is a network mapper utility used to check the availability of hosts and their services. Using nmap, we can check whether a specific TCP/UDP port of a remote host is open or not.
To ping a TCP port of a remote host using nmap: “nmap -p portnumber -sT www.domain.com”
To ping a UDP port of a remote host using nmap: “nmap -p portnumber -sU www.domain.com”
-p : Port number
-sT : TCP connect scan
-sU : UDP scans
Method II:
netcat is another powerful tool, nicknamed as “swiss-army knife” of networking. Among its rich features, netcat can do port scanning as follows.
To ping a TCP port of a remote host using netcat: “nc -z domain.com portnumber”
To ping a UDP port of a remote host using netcat: “nc -zu domain.com portnumber”
-z : scan for listening daemons, without sending any data to them
-u : Use UDP instead of the default option of TCP.
Method III :
If we would like to actually measure network latency as well, you can use paping, which is a cross-platform TCP port testing tool. We can measure the RTT delay using the command paping
“paping domain.com -p portnumber -c 3”
-c : attempts
If you require help, contact SupportPRO Server Admin