Tinc: Difference between revisions
imported>MrVanDalo mNo edit summary |
imported>MrVanDalo mNo edit summary |
||
Line 71: | Line 71: | ||
=== tinc-up/tinc-down === | === tinc-up/tinc-down === | ||
A more robust but more complicated way to configure the | A more robust but more complicated way to configure the interfaces are the <code>tinc-up</code> and <code>tinc-down</code> scripts. | ||
First we have to create the scripts: | First we have to create the scripts: | ||
Line 84: | Line 84: | ||
/run/wrappers/bin/sudo ${pkgs.nettools}/bin/ifconfig $INTERFACE down | /run/wrappers/bin/sudo ${pkgs.nettools}/bin/ifconfig $INTERFACE down | ||
'';</pre> | '';</pre> | ||
For the <code>tinc-down</code> we need to use sudo because | For the <code>tinc-down</code> we need to use sudo, because the user <code>tinc.private</code> who starts the service is not able to tear down the interface. | ||
So we have to | So we have to make sure this user can call sudo without entering a password. | ||
<pre> security.sudo.extraRules = [ | <pre> security.sudo.extraRules = [ | ||
Line 101: | Line 101: | ||
== Open the Firewall == | == Open the Firewall == | ||
The computer which you connect to | The computer which you connect to needs to open some ports. | ||
<pre>networking.firewall.allowedUDPPorts = [ 655 ]; | <pre>networking.firewall.allowedUDPPorts = [ 655 ]; | ||
Line 107: | Line 107: | ||
== use service.tinc module == | == use service.tinc module == | ||
Now we have everything we need to configure the <code>services.tinc</code> module in our <code>configuration.nix</code> | Now we have everything we need to configure the <code>services.tinc</code> module in our <code>configuration.nix</code> file on both machines. | ||
You can recognise that the <code>services.tinc."${myMeshName}".hosts</code> have the same content on both machines. | You can recognise that the <code>services.tinc."${myMeshName}".hosts</code> have the same content on both machines. | ||
It is also ''' | It is also '''important''' that you set <code>services.tinc."${myMeshName}".name</code> to a machine that is contained in the <code>services.tinc."${myMeshName}".hosts</code>. | ||
=== /etc/nixos/tinc.nix on heinz === | === /etc/nixos/tinc.nix on heinz === | ||
Line 124: | Line 124: | ||
in { | in { | ||
# simple interface setup | # simple interface setup |