Tinc: Difference between revisions

imported>Chuangzhu
Update expression to configure interface address
imported>Chuangzhu
Fix systemd unit
Line 68: Line 68:


<syntaxHighlight lang=nix># for heinz
<syntaxHighlight lang=nix># for heinz
networking.interfaces."tinc.private".ipv4.addresses = [ { address = 10.1.1.25; prefixLength = 24; } ];
networking.interfaces."tinc.${networkName}".ipv4.addresses = [ { address = 10.1.1.25; prefixLength = 24; } ];
</syntaxHighlight>
</syntaxHighlight>


Line 74: Line 74:
The following snippet '''seems''' to fix that (until perhaps a more proper fix is upstreamed?):
The following snippet '''seems''' to fix that (until perhaps a more proper fix is upstreamed?):
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
   systemd.services."network-addresses-tinc.${networkName}".before = [ "tinc.${networkName}.service" ];
  # Start the unit for adding addresses if Tinc is started
   systemd.services."network-link-tinc.${networkName}".before = [ "tinc.${networkName}.service" ];
  systemd.services."tinc.${networkName}".wants = [ "network-addresses-tinc.${networkName}.service" ];
  # Stop the unit for adding addresses if Tinc is stopped or restarted
   systemd.services."network-addresses-tinc.${networkName}".partOf = [ "tinc.${networkName}.service" ];
  # Start the unit for adding addresses after the Tinc device is added
   systemd.services."network-addresses-tinc.${networkName}".after = [ "sys-subsystem-net-devices-tinc.${networkName}.device" ];
</syntaxHighlight>
</syntaxHighlight>
Note 2019-12-28: another author found that those lines were counter-productive. Their system hung for 90 seconds on boot waiting for /sys/subsystem/net/devices/tinc.<tinc network name> to be available, and then after booting they had to manually do something to get tinc working. Removing those lines fixed both problems.


=== tinc-up/tinc-down ===
=== tinc-up/tinc-down ===