'Can I configure linux to keep UDP broadcast local to the device for a given port?
I am working with a software which has nodes connected together on a WiFi network (using Zyre, https://github.com/zeromq/zyre ).
There are two clusters of nodes:
- Nodes running on the device locally. These speak only to eachother
- Nodes communicating between devices on the network.
I can separate the clusters 1 and 2 by using UDP discovery on different ports.
However, my problem is that a local cluster will see other local clusters.
What I would like to do is to keep the UDP broadcast messages of the local cluster local on the machine only. Is this possible with some Linux magic?
I have tried:
- Creating a virtual network interface for the local cluster. This works, but unfortunately, a limitation in the Zyre library I am using does not allow multiple network interfaces within a single process, so I am then unable to connect to both the local and global cluster within the same process, which is necessary. Therefore, it looks like both the local and global cluster needs to use the same network interface..
- Playing with iptables. My closest solution is to whitelist udp messages for my local cluster port to the local ip-address. However, I do not want to set this ip-address manually, doesn't scale well for 50-100 devices.
(Zyre has a gossip-feature, which solves the problem, but it is less robust. I would really like to solve the problem using UDP discovery)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
