Protocol (or service publish/discovery) to detect devices in network

bonjourdomain-name-systemipipv4networking

we connect some embedded devices in a network. What i am looking for now, is a way to find the devices IP and identify them.
We work with Windows PC´s and i am about to write a C# tool that should do this.

  1. I thought about send a udp broadcast and in the ack i.e. is the device´s ip,
    which would mean the device needs a daemon runnig to assign an ip itself.

  2. Running a service (like a printer) on the device, and on the PC just lookup for the service.
    I read about some things like apipa, zeroconf, ipv4 local link, bonjour, dns-sd, mdns, bonjour; They can automatically assign ip´s and publish services in a network.

My Question is, can someone recommend me what would be good for my task?
-The protocol or Service should be low on ressource (memory/cpu usage) use.
-Are there some standard protocolls to use?
-Is DNS a good idea or would it be to ressource consumpting just for finding a device´s IP?
-Should also work when no dhcp servers are around.

edit: To clarify a bit: The IP configuration is automatic. The problem to focus is how to tell the PC which IP in the network (or a direct connection in this vase there would only be one) belongs to the device (identity).

Best Answer

My Question is, can someone recommend me what would be good for my task? -The protocol or Service should be low on ressource (memory/cpu usage) use. -Are there some standard protocolls to use?

The standard way to detect devices (and their attributes, such as management ip address) on an ethernet network is to use LLDP.

You can find a list of lldp daemons here

All hosts in an ethernet Vlan will see LLDP announcements, since they are sent to a multicast mac address; this also means LLDP announcements are scoped to a Vlan. If you need device registry and detection across Vlans, you'll need to build your own IP announcement protocol... UDP would be a good choice for the transport.

Is DNS a good idea or would it be to ressource consumpting just for finding a device´s IP?

If you are only looking for an IP address, and do not care whether you can tell whether the device is one of your embedded systems, you could use mDNS; however, this is more risky since you have no guarantee against namespace collisions in a customer LAN.

How should the OP's embedded systems get an IPv4 address, if the customer does not have a DHCP server?

RFC 3330 allocates 169.254.0.0/16 for communication on a single link if a DHCP server is not available. Upon reflection, this is probably the safest block of addresses to use; however, your company should encourage your customers to allocate addresses themselves with DHCP instead of some form of auto-configuration in the 169.254.0.0/16 subnet.

How you assign individual IP addresses within 169.254.0.0/16 is a question that we can't decide for you... a couple of possibilities are:

  • Assign the specific addresses within 169.254.0.0/16 by hashing your mac-address values such that it is unlikely to get collisions for the expected maximum number of your systems on any customer's vlan
  • Listen for some multiple of your systems' LLDP hello interval and allocate an address from 169.254.0.0/16 that has not already been used