Is it correct that
telnet host portwill fail too. But not vice versa.
telnet host portsucceeds,
ping hostwill succeed too. But not vice versa.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Both facts do not have relation and I fail to see how they are related.
PING/ICMP echo-requests can be ignored at firewall and/or kernel level, and the fact that an host does not answer to pings does not prevent it from answering other services.
Likewise being able to telnet a port, does not implies PING will have to answer.
For an example, try pinging www.iscte.pt and then opening it in a browser, or doing:
$ telnet www.iscte.pt 80 Trying 18.104.22.168... Connected to www.iscte.pt. Escape character is '^]'. GET / <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="https://www.iscte-iul.pt/">here</a>.</p> </body></html> Connection closed by foreign host. $ ping -c 1 www.iscte.pt PING www.iscte.pt (22.214.171.124): 56 data bytes ^C --- www.iscte.pt ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss
You can also have a host that only answers to ping, and all the other reminder services are firewalled and do not answer, or only answer to specific IP addresses.
If the firewall and kernel do not ignore ICMPs, you could also have a server with no services, or with setting at layer 7 that limit services to people with X.509 client certs, or VPN servers or servers with UDP services (DHCP....telnet only tests TCP port services) that do not answer to telnet.
That ignoring if they have an SSH service running; it is highly pratical but not mandatory, or it can only be accessed once inside the VPN, for instance.
see related Does `ping` connect to a ICMP server?