I'd like to detect a shutdown machine as fast as I detect there's no service on an running machine. For instance:
$ time telnet 192.168.1.140 80 # An existing machine, no service
Trying 192.168.1.140...
telnet: connect to address 192.168.1.140: Connection refused
telnet: Unable to connect to remote host: Connection refused
real 0m0.003s
user 0m0.001s
sys 0m0.001s
So it takes 3 ms to figure out there's no service on this existing machine. But when I perform:
$ time telnet 192.168.1.222 80 # This machine is shutdown
Trying 192.168.1.222...
telnet: connect to address 192.168.1.222: No route to host
telnet: Unable to connect to remote host: No route to host
real 0m3.017s
user 0m0.001s
sys 0m0.001s
It takes 3 seconds to figure out this machine is shutdown. 1000 times the time of the service test.
Is there a way to shrink this delay?