I want a fast (as in less than a second, not 'computer fast') way of checking if a particular private IP is present on the LAN.
I need this for use in a match construct in an SSH config file, e.g.:-
# # # odin may be remote or local from t430 # Match host odin exec "sh -c 'hostNotLocal 192.168.0.104'" ProxyCommand ssh cheddar nc -q0 localhost 51234
Currently 'hostNotLocal' is:-
#!/bin/bash # # # Test if specified host is ping'able # ! ping -c 1 $1 >>/dev/null 2>&1
The problem with this is that on any LAN except one using 192.168.0.xxx it takes several seconds to decide that 192.168.0.104 isn't there.
For any nit-pickers, yes I know if I just happen to be connected to a LAN which isn't where 'my' 192.168.0.104 is I'll get a false positive but I can live with that. I just want a fast way of knowing that 192.168.0.104 *isn't* there.