4

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).

Gobliins
  • 201
  • 4
  • 11
  • What kind of devices are you talking about. How are they configured? Do you know their MAC addresses? What do you mean by "find and identifying" them? – Sven Sep 26 '12 at 10:49
  • hi, the devices are similar to a camera. They arenormally configured as DHCP Client but thi is not always the case. So when connected i first know nothing about the device (config, ip, mac) – Gobliins Sep 26 '12 at 11:10
  • if i search the network after IP adresses i can firstly not see if the ip belongs to a device or a pc – Gobliins Sep 26 '12 at 11:11
  • what do you mean? – Gobliins Sep 26 '12 at 11:17
  • Would you agree that your actual question is somehing like the following: We manufacture embedded devices that get connected to customers networks we know nothing about. They might or might not have DHCP enabled. What is the best way to detect and configure these devices, e.g. with a setup software we would ship with these devices? – Sven Sep 26 '12 at 11:38
  • Yes, the only two things we need to know: topology and the correct network adapter on the pc that can connect to the device. – Gobliins Sep 26 '12 at 11:48
  • As an example: A printer, from which you know nothing except that you can access it by is IP, is connected in a network, how can the user access the printer? The tool will try to find the printer and then tell the user how to access it. – Gobliins Sep 26 '12 at 11:58

2 Answers2

2

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
Mike Pennington
  • 8,266
  • 9
  • 41
  • 86
  • Hi the routine would be 1. step: get all Ip´s in network 2. step check which ip is device; The lldp does autoassign ip´s or has this to be done before? – Gobliins Sep 26 '12 at 11:06
  • LLDP doesn't assign IP addresses; it is quite useful for discovering the IP address assigned to your embedded systems though. Furthermore, you should not build an embedded system that auto-assigns IP addresses to itself... this will annoy customers. Assume almost everyone is using DHCP, because they pretty-much are... just get your device addresses from DHCP – Mike Pennington Sep 26 '12 at 11:08
  • @MikePennington: As far as I understand it, the OP doesn't really control the devices and what is installed on it, so he couldn't install an LLDP daemon. – Sven Sep 26 '12 at 11:16
  • I think the wording is an artifact of his english, it looks like he is a non-native speaker. I read this as his company builds embedded systems... it doesn't make sense to come here asking how you assign IP addresses to an embedded system when you could just call up the vendor and ask them how they designed their systems – Mike Pennington Sep 26 '12 at 11:20
  • Still the problem exists if no dhcp server is around this is the issue. Why is it not a good idea to auto assign the ip on the device itself? (The only other way would be, configuring the pc as a dchp server but i don´t know if this is possible or an option) – Gobliins Sep 26 '12 at 11:20
  • @mike they get the ip´s how i tell them to get the ip – Gobliins Sep 26 '12 at 11:22
  • @MikePennington: Ah, I start to see. I was seeing this problem from the other side, aka my side, where I sometimes have to deal with strange black box devices that doesn't even have a MAC printed on the case. – Sven Sep 26 '12 at 11:27
  • @mike For that my tool is not there, in case the user wants to do the config, he can. My tool is for automaically assign ip´s and find the device so the user can plug&play nuff said. – Gobliins Sep 26 '12 at 11:32
  • @gobliins, I will update my answer with a more complete solution to assigning addresses when I get to work today – Mike Pennington Sep 26 '12 at 12:04
  • @Gobliins, you're most welcome... please see the update to my answer – Mike Pennington Sep 26 '12 at 19:48
  • The IP in the 169.254.x would be auto assigned by zeroconf , bonjour, ipv4 link local, apipa. The question is which of them is good portable and low on resource usage. After the IP is on the device the identifying (is the ip a device) starts, for that maybe lldp, snmp (upnp) could come into play – Gobliins Sep 26 '12 at 23:24
  • 169.254 is as safe as you can get for no conflicts... it is awful when trying to integrate into a customer's existing network... that's why I said you need to encourage customers to use dhcp – Mike Pennington Sep 27 '12 at 02:16
  • So lets dont think in a network, think of a direct connection. There is mostly no dhcp server present. So what are the options? – Gobliins Sep 27 '12 at 07:17
  • And dont worry about ip confguration, the question is about the transport of the ip and identity of the device. The lldp was a good starting point, but why is lldp better than upnp or snmtp? – Gobliins Sep 27 '12 at 08:17
  • let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/5942/discussion-between-mike-pennington-and-gobliins) – Mike Pennington Sep 27 '12 at 08:51
1

The nmap utility is very good at determining which IP addresses on a network (of your choice!) are occupied. If the host will reply to any request for verifying its presence, then nmap will show it.

Otherwise, you can fiddle with ARP. There are several utilities for all the major OSes that will do this (on Win32 look for Cain, on Linux there are many). These utilities will send out an ARP broadcast/"ping" to every address asking if there is a device connected and if so, what it's IP is.

L0j1k
  • 133
  • 5