Subject: Testing presence of a device by MAC when configuring an Ethernet
To: None <tech-net@NetBSD.org>
From: Chapman Flack <chap@anastigmatix.net>
List: tech-net
Date: 06/27/2006 20:53:53
Hi,

Is there some scriptable method, using binaries present in the base system,
to check for the presence of some known other device by its MAC address
on an ethernet before assigning an IP address to the local interface?

I would like to automate the following check on detecting an interface:

  IF   device-at-known-MAC-address is visible through interface
  THEN this must be home, set my normal fixed IP on the interface.

Obviously I'd rather not go setting my normal IP on the network before
I know it's my network.

I don't mind if the test involves some arcane combinations of utilities,
since it can be put in a script--I've just been trying some fairly twisted
medleys of ifconfig, route, and ping, but without luck yet--but it would
be nice to know if this is something that can be done at all with
utilities present in the base system, or if some package or custom code
would be required.

Thanks,
-Chap

(please cc: me on reply)