[ALUG] What's a fast way to check for something on LAN?

steve-ALUG at hst.me.uk steve-ALUG at hst.me.uk
Wed Feb 22 15:50:16 GMT 2017


On 22/02/17 15:25, Chris Green wrote:
> On Wed, Feb 22, 2017 at 02:22:17PM +0000, Laurie Brown wrote:
> You've illustrated my problem perfectly! That 3 seconds delay is the
> same delay I see using my original ping method.
>
> I need to find out, fast, if 192.168.0.104 isn't on the LAN I'm
> connected to.  To do this I have to run your second case above which
> takes, like my ping, 3 seconds to execute.
>
> [SNIP]
> Makes no difference at all.  The hostIsLocal command will take 3
> seconds to fail when it's not local and I'm no better off.
>

Why is a 3 second delay a problem?


Possible alternatives.  Try to open some sort of connection to the 
address you want to test, using pythion, or SSH or Telnet or something 
else and investigate any timeout options.

Interrogate dhcp logs and see last time a machine was active - if it's 
recent, assume it's there.

Have each machine announce its presence on boot and at regular short 
intervals after to some central log of machines.  Interrogate this for 
the required machine.

Have a machine regularly ping everything to work out who is there and 
who isn't.  Log it and use that log.

Run something during the boot up process to work out the location of 
this machine and deduce if these machines are going to be local or remote.

Fundamentally rearrange your network addressing.

Use DynDns or similar dynamic dns address tools for each machine and 
always access the machines by their dyndns name.

Mess around with the hosts file, do the logic in there to substitute the 
local/remote address for machines.

Modify your network setup and include a bridge or VPN so somehow, each 
machine always has the same IP address.

Live with a 3 second delay.

That should keep you going for a bit!

Steve



More information about the main mailing list