4

At the startup I work, we're setting up a device for image capturing and analysis. It's a box with a camera, with Ubuntu Linux embedded, and, let's assume, we don't want to connect a monitor to this device for configuration.

Some guys came with the solution of having a configuration webpage when connecting the device to a notebook through a network cable directly, just like you do with a router or modem, by accessing a well known IP.

It sounds like a solution, but fact is that the device is not a router, and as I see it, it's quite a different context, the device won't be delegating an address to the notebook (making it part of a router's network, where it can have a well known address) since it's not a router.

So I'm now looking for a solution that resembles the experience of configuring a router, but that's not a router, it's for a device that I should be able to access from a well know address. For that, I've dug a bit about zeroconf/APIPA but from zeroconf RFC 3927 the IP address must be one generated "using a pseudo-random number generator with a uniform distribution in the range from 169.254.1.0 to 169.254.254.255 inclusive".

I think a random IP solution may still work, even though it's not a well know address, in case there's any means of discovering which IP this device has got.

Besides this, this device should be using NetworkManager to handle connectivity through the many interfaces it's setup with.

So, to sum up the problem situation:

  • A device must be configured through a local network.
  • This device is ON and using Network Manager to handle connectivity through many interfaces, let's say one interface connectivity gets down, it would be choosing another interface.
  • We were thinking about having an eth0 alias to have eth0 both being handled by Network Manager (in context with other interfaces) as well as having fixed IP access through a non-managed (by Network Manager) alias. Not sure whether that's even possible.
  • It's all about device discovering, I've also proposed using nmap to reach the device, but it has two drawbacks: scanning is slow on large networks and it's not a simple webpage access, a client using nmap must be built and used to do the discovery.
  • If there's no means to have simple access in a well known IP, having a random one is also a solution, given that the device can be discovered like a printer in the network or something like this.
  • It may be assumed that the solution can be one to configure a device directly connected to a notebook through a network cable and acquire access to it in a device's configuration webpage as well as one solution where the notebook gets connected to the local network the device is also connected, and be able to access the device discovering it in the network or accessing it through an alternative, exotic and fixed address. Notice that accessing the local network router or using nmap/arp scan is not an option.

What matter should be studied to address this problem? Is there a common approach people use for this?

In my experience I recall configuring my devices but none fitting the problem:

  • Router: Provides an easy to access configuration webpage at a well known address, but it's the router, it's the gateway and it will be delegating my own address.
  • Cubox-i: I have one of these devices, I had to discover it using nmap in my network and access its ssh.
  • Printers: I have never owned one, so I don't know how its device discover/configuration works, but have used them on networks before, they were generally listed in the device settings on a Windows machine. I still have to take a look at "Avahi", "UPnP", "Zeroconf" and other names in the field which I never worked with. Maybe this is the kind of example that may fit the situation.

If there's a simple tool I can run on my Arch Linux and have its IP discovered by other devices like my Android or my Windows notebook, I'd like to know. I've also thought about broadcasting but I'm not sure this would be OK in all LANs, where broadcasting could be blocked or unreliable (unsure regarding this).

5

The best way to do this is with avahi which implements multicast-dns (this is what Apple calls Bonjour).

I would disable Network Manager and go with configuring networking in /etc/network/interfaces. The interfaces file supports the ipv4ll method, which uses avahi-autoipd to configure an interface with an IPv4 Link-Layer address (169.254.0.0/16 family).

Next, set up a service in avahi to ensure the host advertises itself via bonjour and add mDNS name resolution to /etc/nsswitch.conf.

If the rest of your systems are configured to resolve mDNS names, it should all work like magic.

2

How to have a device's IP discovered in a network

If there's a simple tool I can run on my Archlinux and have its IP discovered by other devices like my Android or my Windows notebook, I'd like to know.

Sadly there isn't a great way to do this at the moment.

  • You can install avahi-daemon on the device, and Bonjour on Windows. It's commonly suggested you install an older version of this proprietary third-party networking software. Does it include the apple updater? Does the apple updater provide security fixes for the easier-to-install-but-older 2.02 version? I'm sure nothing could possibly go wrong here.

    https://learn.adafruit.com/bonjour-zeroconf-networking-for-windows-and-linux/overview#microsoft-windows

    (Also set a descriptive hostname. With MDNS, you don't need to guarantee the hostname is unique. In fact the MDNS spec says you're not "supposed" to make it unique by appending a random number or a large ID like a MAC address; this is considered to put off users for no good reason. sensor5 would be reasonable though. The protocol automatically resolves conflicts by appending sequence numbers (with a dash) to the MDNS hostname.)

  • You can install Samba on the device and use legacy IPv4 discovery with NetBIOS over TCP. NetBIOS may be disabled-by-default by some enterprise DHCP servers. http://searchenterprisedesktop.techtarget.com/blog/Windows-Enterprise-Desktop/NetBIOS-Tweak-May-Be-Needed-for-Win10-NAS-Access

    (NMB does not tend to resolve naming conflicts. People generating hostnames automatically tend to append the last few characters of the MAC address, to avoid this problem).

  • What you ideally want is LLMNR, which is a more recent protocol used by Windows. systemd-resolved supports this, but it is not widely used. I believe it's a reasonably simple, documented standard and hence you can find self-contained open-source implementations. I don't think they're widely used, but if someone does this commercially - how about you use this and report any bugs please :).

If you want to support Linux clients as well as Windows, you can of course support both MDNS and LLMNR.

Configure a device directly connected to a notebook through a network cable

It may be assumed that the solution can be one to configure a device directly connected to a notebook through a network cable and acquire access to it in a device's configuration webpage as well as one solution where the notebook gets connected to the local network the device is also connected, and be able to access the device discovering it in the network or accessing it through an alternative, exotic and fixed address.

What matter should be studied to address this problem? Is there a common approach people use for this?

I'd say the second most common solution for this problem is as above, except that you missed a trick.

This technique is useful e.g. if a device has been configured with a static address, which is now unknown.

The solution is to provide a "recovery" button (maybe recessed & requiring an unfolded paperclip to press). You boot the device in a recovery mode, where it uses a special fixed IP address. Then you can connect to the known address (using a direct cable & setting your laptop's address manually to be on the same subnet) and reconfigure the device.

  • 1
    Thanks for the LLMNR. At the time we have adopted a mix of the last trick plus Avahi support. – pepper_chico Feb 15 '17 at 14:31

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.