Let me first explain my situation:

I am currently in the process of trying to build a solution for managing multiple Internet of Things devices on a network. It should be possible to automatically make the clients connect to a central server which is hosting an MQTT-Broker.

In IPv4 networks, I would simply send a broadcast packet from the client, to which the server would respond with a packet containing its own IP address. Now that the client knows the IP address of the server, it would be able to connect to it after this.

However, things are different with IPv6, since there is no broadcast anymore. How could I make my client automatically find the server without hardcoding a multicast address?

  • 1
    In IPv6 you should use multicast instead of broadcast. Have you tried that? – Sander Steffann May 19 '17 at 9:28
  • 2
    Even with IPv4, using broadcast in this situation is a rookie move, and evidence of poor application design and lack of understanding networking.. Broadcast interrupts every host on a LAN. You really only want to interrupt a subset of the LAN hosts, and that is where you use multicast. If your application is so poorly designed that you use broadcast, then I know of companies that will not even consider your product. Broadcast should only be used in situations where you want to interrupt every LAN host. – Ron Maupin May 19 '17 at 14:14
  • @RonMaupin Is there a better way to detect the IP address of a server without any prior knowledge about the network at all, using as little code as possible (the clients are VERY limited in memory)? If I understand correctly, DHCP does nothing different for example: Send a broadcast packet that eventually reaches everything - including the DHCP servers. This is similar to what I want to do. This step is only needed once and on subsequent connections, the previous parameters are being taken from storage. Reconfiguration is then only necessary when the network structure changes. – Michael G. May 19 '17 at 15:49
  • DHCP was created before there was multicast. Multicast was created to solve the problem of many hosts flooding the network with broadcasts, which wastes network bandwidth and clogs the LAN. We are stuck with the way DHCP works for IPv4. As an improvement, IPv6 has eliminated broadcast, and it uses multicast for many things. The modern way to do things is to use multicast instead of broadcast. Multicast only interrupts those hosts subscribing to the multicast group, where broadcast interrupts every host on the LAN. – Ron Maupin May 19 '17 at 15:54
  • Many IoT devices are very limited in resources, yet they run IPv6, and they use multicast instead of broadcast. As I explained before, many companies will reject during testing applications that simply broadcast instead of intelligently using the LAN resources. – Ron Maupin May 19 '17 at 15:56

In IPv6, there’s no longer any broadcast – sending one packet to a large number of unspecified hosts. There’s only multicast, unicast and anycast. In IPv6 all nodes are required to support multicast. Without multicast, many services that you need will simply not work.

Source: http://ipv6friday.org/blog/2011/12/ipv6-multicast/

  • Is there any way to automatically find a multicast address or do I have to specify one and hardcode it into my software? – Michael G. May 19 '17 at 9:38
  • You could read the article. IPv6 does not work without multicast. DHCP in IPv6 is sent via multicast etc. – Cown May 19 '17 at 9:42
  • My question is whether it is possible to use a multicast address that can be specified individually or if I have to specify one that must be used in all cases. For example, I could specify the – Michael G. May 19 '17 at 9:44
  • Yes it is possible and it is also explained the article: COPY/PASTE Multicast can be sent with different scopes, like global, site-local (your network) or link local (everyone on the same LAN). By combining a service address with a scope you can reach exactly the hosts you want. And when creating new applications your servers can register for a multicast address and your clients send to it to reach the set of servers. – Cown May 19 '17 at 9:47
  • Sorry, I just noticed that my edit didn't send. Anyway, I could for example specify the address FF02::F001 but it might already be used in this network. Is there a way to not define the address beforehand but rather adapt it to the network it will be used in? Otherwise I will probably just have to take any multicast address and hardcode that. – Michael G. May 19 '17 at 10:16

The formal/correct way to do this for both IPv4 and IPv6 is to use "service discovery". Apple's "Bonjour" system is an example.

I can think of two proper ways for automatic service discovery:

  1. Register a IPv6 Multicast address with IANA and make your software listen to that address.

  2. Make your service (or the host running the service) send Multicast DNS packets to make itself known to the network.

Both should work for IPv4 and IPv6.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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