Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Set Up a Two-Node Tinc Mesh VPN on Linux

Configure a private Tinc 1.0 network, exchange public host files, and verify your Linux VPN before enabling it at startup.

Table of Contents

To build a two-node Tinc mesh on Linux, give each computer a unique VPN address, generate its keys, and exchange the public host files. This example uses Tinc 1.0 and two Linux computers you administer on the same private LAN. Expand the mesh only after the first two nodes can reach each other.

1. Install and plan the network

On both Debian or Ubuntu systems, run:

sudo apt update
sudo apt install tinc
tincd --version

Use the Tinc documentation for your installed version. The commands below are for 1.0. Choose a VPN subnet that does not overlap any LAN or VPN route on either host. This example uses 10.78.42.0/24.

How to Create P2P Mesh VPN with Tinc Picture 1

How to Create P2P Mesh VPN with Tinc Picture 2

How to Create P2P Mesh VPN with Tinc Picture 3

2. Name the nodes and configure their public host files

Create /etc/tinc/mesh/hosts on each computer. On the first computer, put Name = alpha in /etc/tinc/mesh/tinc.conf. On the second, put these lines in the same file:

Name = beta
ConnectTo = alpha

On alpha, create /etc/tinc/mesh/hosts/alpha with the following lines, replacing 192.168.1.20 with alpha’s reachable private LAN address:

Address = 192.168.1.20
Subnet = 10.78.42.1/32

On beta, create /etc/tinc/mesh/hosts/beta with Subnet = 10.78.42.2/32. Run sudo tincd -n mesh --generate-keys=4096 on each machine, accepting the default key locations. Exchange only hosts/alpha and hosts/beta, which include the public keys. Keep the private key on the machine that generated it.

The original screenshots show the same configuration roles with different example node names and addresses.

How to Create P2P Mesh VPN with Tinc Picture 4

How to Create P2P Mesh VPN with Tinc Picture 5

How to Create P2P Mesh VPN with Tinc Picture 8

How to Create P2P Mesh VPN with Tinc Picture 9

How to Create P2P Mesh VPN with Tinc Picture 11

How to Create P2P Mesh VPN with Tinc Picture 12

How to Create P2P Mesh VPN with Tinc Picture 13

3. Set up the VPN interfaces

On alpha, save this as /etc/tinc/mesh/tinc-up:

#!/bin/sh
set -e
ip link set dev "$INTERFACE" up
ip address add 10.78.42.1/24 dev "$INTERFACE"

On beta, use the same script with 10.78.42.2/24. Make both scripts executable with sudo chmod 755 /etc/tinc/mesh/tinc-up. The example installs the subnet route through the address assignment. When the interface is destroyed, that route disappears.

4. Test the tunnel before enabling startup

Allow Tinc’s default port 655 on the private network as needed for the authorized peers. On alpha, then beta, run sudo tincd -n mesh -D and leave both terminals open. From another terminal on alpha, run ping -c 4 10.78.42.2. Use ping and path checks to separate a LAN reachability problem from a VPN routing problem.

If the peers cannot connect, check alpha’s reachable address, the firewall, the exact spelling of both node names, and whether each public host file appears on both machines. If the tunnel connects but ping fails, also check VPN routes and whether the host firewall permits ICMP. Stop the foreground instances before starting a packaged service. If your package provides it, enable tinc@mesh.service only after the test succeeds.

How to Create P2P Mesh VPN with Tinc Picture 14

How to Create P2P Mesh VPN with Tinc Picture 15

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.