[routable IP addresses]
If the machine you want to ping uses an IP address from one of the
bogon ranges then traffic to and from that IP address is meant to be for local purposes [skip discussing NAT]. IANA designated LAN ranges (see
http://www.cymru.com/Documents/bogon-bn-nonagg.txt) for that. IP addresses in those ranges are called "unroutable" because no routing-capable source on the Internet will or can route traffic for those [skip discussing DNS 127.0.0.0/8 hostname entries].
[resolving unroutables]
If you want to ping a machine by name the OS needs to resolve that hostname to an IP address. If the application has no built-in resolver then it will query configured DNS servers according to "hosts" configuration in /etc/nsswitch.conf. Usually this means trying DNS first, then fall back to the local "database" (/etc/hosts). Because "unroutables" can't be resolved externally you require either your local DNS (Pdns, dnsmasq) or /etc/hosts to serve up the name-to-IP mapping or use the IP address instead of the hostname.
[ping vs tcptraceroute]
In the days when 200 ton
dinosaurs admins roamed the Earth, a few cavemen from the DARPA tribe devised a way of connecting tin cans with string and talk to each other. Where tin cans are miles apart this lead to using the IP suite of protocols. ICMP is part of the IP family and used for error correction. Ping uses the ICMP protocol to see if a tin can can be talked to (
notice the "ping"-like sound a tin can makes when you tap it with a metal object). Ping sends one or more ICMP packets of Type 8 (echo request) to the host and listens for the response [skip discussing firewalking]. If the response is ICMP packets of Type 0 (echo response) then that marks the host as reachable. Unfortunately ping was abused by some (
notice the "smurf"-like sound a tin can makes once when you hit it hard with a mallet) and was treated as the black sheep of the family ever since the Dark Ages. In the Age of Enlightenment the hippies Mel and Steve from the "Gibson Research Corporation" band advocated muffling your tin can with gobs of virtual PUR. Like all dealers they obviously used too much of their own product but ever since the leet technique was to be known as "stealth". Religious followers of this "stealth" claim it can cure all sorts of ailment and hope it one day will bring
World Peace. (As with all misguided souls these zealots forget that ICMP was supposed to be let through and therefore suffer from missing out on the benefits of the error correction the rest of the 'net enjoys.)
Because ping (and traceroute) only tell you if a machine is reachable and nothing else,
Cyberdyne Systems will invent Some Other Spaced Out Tools like tcptraceroute, LFT, Pakketto Keiretsu around 2018 AD local that can help them decide if a
port is reachable over TCP (why?
Just because they can). Because most people don't really hate Hollywood (or the endless stream of failing remakes and lame sequels it stands for) these tools were imported in this parallel universe by Neo a few years ago (all hail Neo) so unless you're more into downing particularly bad batches of pills
you too are expected to use tcptraceroute instead of ping.