Networking · MikroTik · VPN

Connecting branch offices with WireGuard on MikroTik

Caddy.uz engineering team3 min read

Most organisations we work with have the same problem: a head office in Tashkent, a few branches or warehouses elsewhere, and a mix of port forwards, remote-desktop tools and ad-hoc VPNs holding it together. Since RouterOS 7, MikroTik routers support WireGuard natively, which makes a clean site-to-site design simple to build and easy to maintain.

This article walks through the approach we use for a hub-and-spoke network. It assumes RouterOS 7 on every router and a static public address (or a reliable DNS name) at the head office.

1. Plan the addressing first

Before touching a router, write down three things:

  • The tunnel network. A small, dedicated range such as 10.10.0.0/24. The hub takes 10.10.0.1, each branch gets the next address.
  • The LAN behind each site. Every site needs a unique range — for example 192.168.10.0/24 for head office, 192.168.20.0/24 for branch one. Overlapping LANs are the most common reason site-to-site projects stall.
  • What should talk to what. Branch users usually need the ERP server and file shares at head office, not each other's printers.

2. Create the interface and keys

On each router, create a WireGuard interface. RouterOS generates the key pair for you:

/interface wireguard add name=wg-sites listen-port=13231
/ip address add address=10.10.0.1/24 interface=wg-sites

On the branch, use its own tunnel address (10.10.0.2/24). Copy each router's public key from /interface wireguard print — the private key never leaves the device.

3. Add peers and routes

On the hub, add one peer per branch. allowed-address lists the tunnel address and the LAN behind that branch:

/interface wireguard peers add interface=wg-sites public-key="<branch-key>" allowed-address=10.10.0.2/32,192.168.20.0/24
/ip route add dst-address=192.168.20.0/24 gateway=wg-sites

On the branch, the single peer is the hub, with endpoint-address set to the hub's public address and persistent-keepalive=25s so the tunnel survives NAT on mobile or shared uplinks.

4. Firewall rules

Allow UDP 13231 on the hub's input chain, then restrict forwarding between the tunnel and the LANs to the services that are actually needed. A tunnel is not a reason to make every device reachable from every site.

5. Checks before go-live

We do not hand over a site link until these pass:

  1. Ping and traceroute across the tunnel in both directions.
  2. A file copy of a large file to confirm MTU settings — WireGuard adds overhead, so we usually set the interface MTU to 1420 and clamp TCP MSS where needed.
  3. A reboot test on both routers to confirm the tunnel returns on its own.
  4. Monitoring: the tunnel's last handshake and traffic counters are polled, with an alert if a site goes quiet.

When to use something else

WireGuard is a good default for site-to-site links, but it is not the only option. If you need dynamic routing across dozens of sites, consider OSPF over the tunnels. If a partner insists on IPsec, RouterOS handles that too.

If you want us to review an existing branch network or design a new one, see our enterprise networking service or contact us.

Talk to an engineer about your project

Tell us what you run today and what has to change. We reply within one business day with next steps, not a sales script.

Call usBook a consultation