Start Tinc automatically
We will now make the server and nodes (if you want them to) automatically setup and run the VPN. We are now going to get tinc to launch automatically with systemd
Create a systemd service file
Systemd is a way to manage (start/stop) services like VPNs etc. Tinc is such a service.
To do this you will create a new service file in the folder /etc/systemd/system
In this case we create a special kind of service file (that has an @ in the name) that allows it to work for multiple network names.
sudo nano /etc/systemd/system/tinc@.service
Inside that file, paste the following:
[Unit] Description=Tinc (%i) After=network.target [Service] Type=simple WorkingDirectory=/usr/local/etc/tinc ExecStart=/usr/local/sbin/tincd -D -n %i ExecReload=/usr/local/sbin/tincd -D -n %i -kHUP TimeoutStopSec=5 Restart=always RestartSec=60 [Install] WantedBy=multi-user.target
Starting Tinc service
Now we can start it with the command below:
Syntac:
sudo systemctl start tinc@<NETNAME>
so we did:
sudo systemctl start tinc@systerserver
Start service automatically
To make the VPN start automatically we enable it with:
Syntax:
sudo systemctl enable tinc@<NETNAME>
So we did:
sudo systemctl enable tinc@systerserver
Debug if any tinc servers are running
If you are having issues you can debug with:
systemctl --type=service | grep tinc