Install Tinc & create mesh VPN

ssh user@server

* Load the latest updates and install tinc

apt-get updates; apt-get upgrade
apt-get install tinc

* Navigate to the tinc folder and edit the config file nets.boot by pasting the parameter “mws” (without the “”) inside.

cd /etc/tinc/
vi nets.boot

mkdir mws

* Change into the mws folder

cd mws

* Create a new configuration file inside the mws directory and edit it

touch tinc.conf
vi tinc.conf
Name = dfk
#BindToAddress = * 656
#Mode = switch
ConnectTo = dfk
GraphDumpFile = /var/log/mws.tinc.graph
ProcessPriority = high
MaxTimeout = 5
openssl genpkey -algorithm RSA -out rsa_key.priv -pkeyopt rsa_keygen_bits:2048
openssl rsa -pubout -in rsa_key.priv -out rsa_key.pub
chmod 600 rsa_key.priv
mkdir hosts

cd hosts

* create a file inside the directory

touch dfk

vi dfk

* Paste folowing configuration inside

Address = backup.dfkg.org 656
Subnet = 10.0.17.101
Compression = 10

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0SDtzb2vtWXhliyWCCLG
fZZbdmJkwhxMBI3Eure7pbiID5XBd45vioBuZPr3nQHHapnfUxToPr9IhbW2TSzB
1uMqOldFoacGSXwKBg1GmJh+eymZfcnrvglPQBaI6TDflFeyyQAEokLQQTJUbwPO
2lVWgthMvbw4ucJXww9wLDJqoqd4SclfzMGzSUM+rbacIEa7YuDnzKbr75GMqNpI
BUMkPSarmEM4yf9NicvVxosBu+qf04dsyBhKOfhS/IbpYBxtmTbujWg0D7NHpoAU
xHQ8gpXoeqG0DffxWjLttWfywA/mVqFbeq1ABYcJl57isKLihA76vjbnBq767YnH
DwIDAQAB
-----END PUBLIC KEY-----

cp dfk city

* Edit the city file

vi city
touch tokyo
vi tokyo
cd /etc/tinc/
touch tinc-up
vi tinc-up
#!/bin/bash

ip link set $INTERFACE up
ip addr add 10.0.17.110/24 dev $INTERFACE
cd /etc/tinc/
touch tinc-down
vi tinc-down
#!/bin/bash
ip addr del 10.0.17.110/24 dev $INTERFACE
ip link set $INTERFACE down
chmod +x tinc-down
chmod + xtinc-up
systemctl start tinc.service
journalctl -u tinc.service
#ConnectTo = tokyo
cat /var/log/mws.tinc.graph