Tinc/NewNode: Difference between revisions
From charlesreid1
| Line 51: | Line 51: | ||
</pre> | </pre> | ||
Edit the file cronus, | Edit the file cronus to add the IP and subnet for cronus: | ||
<pre> | |||
$ cat hosts/cronus | |||
Address = 192.168.125.50 | |||
Subnet = 10.0.0.0/16 | |||
</pre> | |||
Generate a public key by running tinc with the <code>-K</code> flag, which will add the public key to the end of the cronus machine host file: | |||
<pre> | |||
$ tincd -n master -K | |||
</pre> | |||
Add cronus file the tinc-hosts repository and commit it. | |||
Pull the updated cronus machine file on other machines (e.g. jupiter) | Pull the updated cronus machine file on other machines (e.g. jupiter) | ||
==Setting Up New Debian Node== | |||
Install: | |||
<pre> | |||
$ apt-get install tinc | |||
</pre> | |||
Prep directory structure: | |||
<pre> | |||
mkdir -p /etc/tinc/master/ | |||
cd /etc/tinc/master/ | |||
</pre> | |||
Edit tinc.conf: | |||
<pre> | |||
$ cat tinc.conf | |||
Name = rojo | |||
AddressFamily = any | |||
Mode = switch | |||
</pre> | |||
Edit tinc-up and tinc-down: | |||
<pre> | |||
$ cat tinc-up | |||
#!/bin/sh | |||
ifconfig $INTERFACE 10.6.0.4 netmask 255.255.0.0 | |||
$ cat tinc-down | |||
#!/bin/sh | |||
ifconfig $INTERFACE down | |||
</pre> | |||
Make executable: | |||
<pre> | |||
$ chmod +x tinc-up tinc-down | |||
</pre> | |||
Make hosts directory: | |||
<pre> | |||
$ git clone https://charlesreid1.com:3000/charlesreid1/tinc-hosts.git hosts | |||
$ cd hosts | |||
</pre> | |||
Edit the file cronus to add the IP and subnet for rojo: | |||
<pre> | |||
$ cat hosts/rojo | |||
Address = charlesreid1.com | |||
Subnet = 10.0.0.0/16 | |||
</pre> | |||
Generate a public key by running tinc with the <code>-K</code> flag, which will add the public key to the end of the rojo machine host file: | |||
<pre> | |||
$ tincd -n master -K | |||
</pre> | |||
Add rojo file the tinc-hosts repository and commit it. | |||
Pull the updated rojo machine file on other machines. | |||
==Network Architecture/Configuration== | ==Network Architecture/Configuration== | ||
Revision as of 02:16, 22 January 2018
Procedure for adding a new node (Mac):
Setting Up New Mac Node
Install:
$ brew install tinc
Prep directory structure:
mkdir -p /usr/local/etc/tinc/master/ cd /usr/local/etc/tinc/master/
Edit tinc.conf:
$ cat tinc.conf Name = cronus AddressFamily = any Mode = switch ConnectTo = jupiter
Edit tinc-up and tinc-down:
$ cat tinc-up #!/bin/sh ifconfig $INTERFACE 10.6.0.3 netmask 255.255.0.0 $ cat tinc-down #!/bin/sh ifconfig $INTERFACE down
Make executable:
$ chmod +x tinc-up tinc-down
Make hosts directory:
$ git clone https://charlesreid1.com:3000/charlesreid1/tinc-hosts.git hosts $ cd hosts
Edit the file cronus to add the IP and subnet for cronus:
$ cat hosts/cronus Address = 192.168.125.50 Subnet = 10.0.0.0/16
Generate a public key by running tinc with the -K flag, which will add the public key to the end of the cronus machine host file:
$ tincd -n master -K
Add cronus file the tinc-hosts repository and commit it.
Pull the updated cronus machine file on other machines (e.g. jupiter)
Setting Up New Debian Node
Install:
$ apt-get install tinc
Prep directory structure:
mkdir -p /etc/tinc/master/ cd /etc/tinc/master/
Edit tinc.conf:
$ cat tinc.conf Name = rojo AddressFamily = any Mode = switch
Edit tinc-up and tinc-down:
$ cat tinc-up #!/bin/sh ifconfig $INTERFACE 10.6.0.4 netmask 255.255.0.0 $ cat tinc-down #!/bin/sh ifconfig $INTERFACE down
Make executable:
$ chmod +x tinc-up tinc-down
Make hosts directory:
$ git clone https://charlesreid1.com:3000/charlesreid1/tinc-hosts.git hosts $ cd hosts
Edit the file cronus to add the IP and subnet for rojo:
$ cat hosts/rojo Address = charlesreid1.com Subnet = 10.0.0.0/16
Generate a public key by running tinc with the -K flag, which will add the public key to the end of the rojo machine host file:
$ tincd -n master -K
Add rojo file the tinc-hosts repository and commit it.
Pull the updated rojo machine file on other machines.
Network Architecture/Configuration
The setup with Tinc when there are multiple nodes is as follows:
jupiter = debian server, cronus = mac, maya = mac
Jupiter is the "server" (spoke on the wheel). Tinc is a peer-to-peer VPN model, but we can still have everybody share a single connection to the most convenient nearest server, which for cronus and maya is jupiter.
Jupiter will not be set to connect to anyone, so it will simply listen for incoming connections.
Cronus will bet set to connect to Jupiter when Tinc starts.
Maya will be set to connect to Jupiter when Tinc starts.
tinc.conf on jupiter:
$ cat tinc.conf Name = jupiter AddressFamily = any Device = /dev/net/tun Mode = switch
tinc.conf on cronus:
$ cat tinc.conf Name = cronus AddressFamily = any Mode = switch ConnectTo = jupiter
tinc.conf on maya:
$ cat tinc.conf Name = maya AddressFamily = any Mode = switch ConnectTo = jupiter