Alternate to pinging boxes

Hello,
We have boxes on a WAN network I guess you would call it, pretty much they are hooked up via DSL in different locations in the US and we connect to them via SSH for a secure connection. Some of the boxes won't return a ping request like they are down, I am guessing is because the router isn't setup to return a ping request. In Linux is there a alternate way to determine if the box is up besides ping that may work. This would need to be something I do in the shell script. I would like to attempt ping first, then if it fails try some other method. Thanks for any suggestions.

If there are firewalls up you may never know if another host is up unless (a) you are allowed to talk to it (b) you use the explicit protocol it's designed to permit.

That said, however, you may have fun with "traceroute".

Also, you can try ssh to another box and run ping/traceroute from that host if you need to get around a firewall.

As Porter suggested, use traceroute, or even "tcptraceroute" if available, otherwise you can also use "telnet hostname port" - if you have application on some remote port, let's say apache on port 80, telnet will return some response.

traceroute might be shut out by the firewall, even a modest "ping -R" i have already seen being blocked by a firewall. But if you have *some* possible mode of connection you can use that to determine if the host is up. If this mode of connection is ssh, then use "ssh host date" or something such and analyze the output you get. A valid date would mean the host is up, if you get back nothing you can conclude the host is down.

What you really use for this purpose depends on what you are allowed to do on the remote host but i think the idea is clear.

bakunin

As above, doing "telnet host port" will test your connection. The port can be anything (eg. 22 for SSH).
So I would try something like:

echo "^]q" | telnet mywanbox 22
case $? in
  0) echo "mywanbox is up.";;
  *) echo "mywanbox not responding";;
esac

(Where you get ^] by pressing Ctrl-V Ctrl-].)

@prowla: yes, this is a good idea. Alas, it depends on the firewall not filtering telnet packages altogether (some paranoid firewall administrators will set their boxes to "stateful inspection" and filter out telnet packets regardless of the port they are directed to), which is why i was a bit more vague about it.

In case this works it is a good solution, though.

bakunin