Konstantinos Antoniou.

← Projects

Bridging Two Sites with ZeroTier VPN

Introduction

Managing multiple sites in a homelab or small-office network setup often means balancing security,reachability, and simplicity. Traditional VPNs like IPSec or WireGuard can be powerful but tend to involve complex configurations, NAT traversal headaches, and manual key management.

To streamline remote access and unify my network topology, I deployed a ZeroTier-based site-to-site VPN connecting my Site A (home) and Site B (work). Both sites run MikroTik routers, which makes this setup lightweight, robust, and fully automated.

The goal: make the two LANs communicate as if they were a single extended network, allowing devices and services to interact seamlessly — whether I’m at home or at work.


🧠 Overview

Here’s the architecture at a glance:

| Site   | Router           | Network Range     | Role          |
|--------|------------------|-------------------|---------------|
| Site A | MikroTik RB4011  | 192.0.2.0/25   | Main hub      |
| Site B | MikroTik hAP ax² | 192.0.2.128/25 | Remote branch |

The objective was to create a Layer 3 bridge between these two subnets using ZeroTier’s virtual overlay network.
Once configured, any device on Site A could ping, SSH, or access web services on Site B — without port forwarding, dynamic DNS, or complex IPSec tunnels.


⚙️ Why ZeroTier?

ZeroTier is a software-defined network (SDN) solution that combines the simplicity of a VPN with the flexibility of a mesh network.
It handles NAT traversal automatically and provides:

  • Private IP addressing within a virtual network
  • Automatic peer discovery and encrypted tunnels
  • Centralized control via a web interface
  • Multi-platform clients (Linux, Windows, Android, MikroTik, etc.)

Unlike traditional VPNs, ZeroTier establishes direct peer-to-peer links whenever possible, using relays only as fallback — resulting in low latency and high throughput between sites.


🧩 My Setup Goals

  1. Connect both routers to the same ZeroTier network.
  2. Allow traffic between LAN subnets (192.0.2.0/25 ↔ 192.0.2.128/25).
  3. Keep full internet breakout at each site (no forced tunneling).
  4. Use static routes so that any device on one site can reach the other transparently.

🛠️ Step 1: Create a ZeroTier Network

First, I logged into the ZeroTier Central dashboard and created a new network.

Screenshot 1: 🛠️ Step 1: Create a ZeroTier Network

Screenshot 2: 🛠️ Step 1: Create a ZeroTier Network

The network ID generated (a 16-character string) identifies my private overlay — let’s call it:

Network ID: a1b2c3d4e5f6a7b8

Under Network Settings, I enabled:

  • IPv4 auto-assign: 198.51.100.0/24
  • Allow Managed Routes: ✔️
  • Allow Ethernet Bridging: ✔️
  • Private Network: ✔️

This network will serve as the virtual link between both routers.


🔌 Step 2: Install and Configure ZeroTier on MikroTik

MikroTik’s RouterOS (v7 or later) supports ZeroTier natively, so installation is just a few CLI commands.

On both routers, I ran:

/interface zerotier
add name=zerotier1 network=a1b2c3d4e5f6a7b8 disabled=no

Then, verify the connection:

/interface zerotier info

Once the routers appear under Members in the ZeroTier dashboard, I authorized them and assigned IPs automatically:

  • Site A router: 198.51.100.1
  • Site B router: 198.51.100.254

At this stage, the routers are securely connected over the ZeroTier network.


🧭 Step 3: Add Static Routes Between Sites

Next, I configured static routes on both routers so that LAN traffic could flow across the ZeroTier link.

On Site A (RB4011):

/ip route add dst-address=192.0.2.128/25 gateway=198.51.100.254 comment="Route to Site B via ZeroTier"

On Site B (hAP ax²):

/ip route add dst-address=192.0.2.0/25 gateway=198.51.100.1 comment="Route to Site A via ZeroTier"

This establishes bidirectional routing — Site A knows where to send traffic for Site B, and vice versa.


🔒 Step 4: Update Firewall Rules

/ip firewall filter add chain=forward in-interface=zerotier1 action=accept comment="Allow ZeroTier traffic"

Optionally, you can restrict access to specific subnets or protocols if you want finer control.


🧱 Step 5: Testing Connectivity

From a device on Site A, I ran:

ping 192.0.2.254

Also can perform higher-level connectivity tests:

  • SSH from Site A to a device in Site B
  • Access Site B’s NAS or web dashboard
  • Use traceroute to verify the path through the ZeroTier interface

Everything worked as if both sites were on one LAN.


🧠 Lessons Learned

This setup drastically simplified remote access and network management.
Compared to IPSec or OpenVPN, ZeroTier required minimal configuration, no static IPs, and zero manual NAT rules.

A few key takeaways:

  • ZeroTier’s NAT traversal makes it ideal for dynamic or residential connections.
  • Routing remains under your control — no need to push default gateways.
  • MikroTik’s integration makes it a reliable, lightweight bridge for permanent site-to-site links.

Now, both sites behave like a unified network — file sharing, SSH access, and service discovery all work natively.


📦 Resources