1

On Linux we have a service running which is listening on port 9999 but when we try to check it from a Windows machine on same network with PING it says :

Ping request could not find host 10.32.9.82:9999

while when I tried using telnet like

telnet 10.32.9.82 9999

and Telnet got connected successfully.

So what I am trying to understand that why the telnet worked but does PING not as the service is listening on the IP and port on TCP.

Dave M
  • 4,514
  • 22
  • 31
  • 30
Ehsan Sajjad
  • 113
  • 1
  • 5
  • 3
    Ping uses ICMP, which does not have the concept of ports. Telnet uses TCP, which uses ports as addressing. You cannot ping to a port number. – Ron Maupin Dec 29 '20 at 18:02

1 Answers1

4

You can't ping a port number (ping says that the device is reachable, nothing more).

But you can use something like this powershell cmdlet instead: Test-NetConnection

Test-NetConnection 10.32.9.82 -Port 9999

You'll get an output like that, note that the output shows if Ping succeeded, and if the port is reachable, that's two different things !

RemoteAddress          : 10.32.9.82
RemotePort             : 9999
InterfaceAlias         : Ethernet
SourceAddress          : 192.168.1.166
PingSucceeded          : True
PingReplyDetails (RTT) : 1 ms
TcpTestSucceeded       : True
Swisstone
  • 6,725
  • 7
  • 22
  • 32
  • thanks, makes sense now, is telnet and this command are same thing ? – Ehsan Sajjad Dec 29 '20 at 18:24
  • 1
    @EhsanSajjad No, telnet is an old protocol to connect to a terminal and send/receive text commands. Telnet is not meant to check if ports are open, although some people use it for that but it makes little sense. Something like `Test-NetConnection` is meant to Test network connections so it's the command I recommend for this use case. Plus it's easily scriptable. – Swisstone Dec 29 '20 at 18:36