System network interfaces
Latest StaexMCC integrates with operating system network interfaces. Upon start StaexMCC creates virtual TUN interface and assignes an IPv4 address. After that applications can use this interfaces for communication the same way as they use any other network interface. This feature enables Staex to tunnel application-level protocols that send IP addresses inside packets (e.g. SIP), and also allows to run applications that establish connections or send data dynamically to arbitrary nodes in the network (e.g. MQTT, DDS, Ansible).
To enable system network interfaces integration we use the following flags.
mcc -net -net-ip 10.111.0.1/16 # node 1: IP address is 10.111.0.1, netmask is 255.255.0.0
mcc -net -net-ip 10.111.0.2/16 # node 2: IP address is 10.111.0.2, netmask is 255.255.0.0
mcc -net -net-ip 10.111.0.3/16 # node 3: IP address is 10.111.0.3, netmask is 255.255.0.0
-net enables the creation of TUN interface and
-net-ip 10.111.0.1/16 specifies the IPv4 address that is assigned to the interface.
There is also
-net-ack flag that enables acknowledgement for each packet sent
to improve reliability of data transmission.
This flag should be used with caution as it may degrade performance of the network.
System-provided congestion control does the same job and is enabled by default in most systems.
You can choose any address but make sure that each address is unique and network masks on all nodes are the same. It is also a good idea to specify large enough mask beforehand to never change it in the future. Ideally you should not change the IPv4 address that you assigned to the interface. Due to the nature of how mesh networks work its value is replicated on many nodes, and it would take about 10 minutes until all replicas of old values disappear from the network.
Below you can see the interface created by StaexMCC. Query TUN device status:
ip address show tun0
13: tun0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1100 qdisc fq_codel state UNKNOWN group default qlen 500
inet 10.111.0.1/16 scope global tun0
valid_lft forever preferred_lft forever
Query Staex status:
systemctl status mcc
● mcc.service - Mesh Companion Container daemon
└─101532 /usr/sbin/mcc -net -net-ip 10.111.0.1/16 # pre-configured IPv4 address
Query node id: