We have a linux-based networking product (call it "Z") and we tend to sell them in batches so that they all run on the same subnet doing the same kinds of stuff and reporting data back to a single server (also on the subnet) that coordinates them all.

The units are running a custom, homebrew version of Linux based on a 2.6 kernel.

I have been asked to look into the possibility of adding the following feature:

"Any Z unit must be able to find other Z units on the local subnet and list their IPv4 addresses. The list must not include other unrelated computers present on the local subnet."

An example:

  • User can ssh into any arbitrary Z unit and issue a command (could be a new bash script) called "listLocalSiblings".
  • The Z unit will investigate the local network vicinity and output a simple textual list of the IP addresses of ONLY the other Z units...

There may be multiple unrelated devices on the subnet running various operating systems. I would like this to be as passive as possible (eg. avoid port scanning or having a listener waiting for and responding to special "pings").

Is there a generic way under Linux to categorise networked devices?

I do have the luxury of adding new software to the product but if there is a way to do this based on some kind of intrinsic signature that each machine might have, that would be preferable. We have never tried to make these machines "see" each other before without actually hard-coding pathways for them to find each-other.

Edit: for various reasons, we cannot obtain this info from the server. For now, assume the server has crashed or the ethernet cable has been pulled out of the back of it.

The list is then shown to the user for her to do with as she pleases.

The Z devices are roughly all the same hardware although the older ones have older versions of the Linux system and older motherboards and NICs as you'd expect.

Ideally it would be nice to just drop a bash script on each unit and run it, but I don't know enough about networking tools to know if this is a realistic prospect.

  • 7
    You might want to read up on Avahi, as that could do a chunk of the stuff you want (e.g., see this question) – Eric Renouf May 26 '17 at 13:19
  • 1
    There is no generic way, but nmap can fingerprint Linux OS versions to some degree. Also, the open ports you have on your Z product may be characteristic (or not). The proper, foolproof way is to add a small piece of software, possibly configuring existing software already present on Z, that does the identification. – dirkt May 26 '17 at 14:18
  • Wouldn't the server be able to keep track of the various hosts? If so, it would be easy for a host to get a list of the other hosts from the server. – Kusalananda May 26 '17 at 14:21
  • If the server can serve VPN, you might put them all on their VPN. – Tomasz May 26 '17 at 14:27
  • 2
    Use something like arping or ping to a broadcast address then look at the mac addresses returned with arp -n. You have a list of all the mac addresses of your products I imagine, eg if you are assigning them to the hardware yourselves they will all have your entreprise id. – meuh May 26 '17 at 15:43

scan with nmap, or send a broadcast packet with nc, or use NetBIOS, or by abusing the routing table or ARP packets.

There are a lot of existing network traffic types that can be used without trigering an IDS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.