MikroTik WireGuard Site-to-Site VPN (RouterOS v7)
Connect two offices with a fast, simple WireGuard tunnel on RouterOS v7: keys, tunnel addresses, peers, routes and firewall, with verification and common mistakes.
Problem
You want two offices (Head Office and Branch) to reach each other's LAN securely over the internet. IPsec is complex; WireGuard on RouterOS v7 is simpler and fast.
Symptoms
- The tunnel shows no handshake.
- The tunnel is up but the remote LAN does not answer pings.
Likely causes
WireGuard only works when each side has the other's public key, the correct allowed-address list, a route to the remote LAN, and an open UDP port on at least one side.
Prerequisites
- RouterOS v7 on both routers.
- At least one side with a public IP (or a DDNS name). Example: Head Office public IP
203.0.113.10, LAN192.168.10.0/24; Branch LAN192.168.20.0/24. - Tunnel subnet:
10.99.0.0/30.
Solution (WinBox / CLI)
1. On both routers, create the interface and note the public key:
/interface wireguard add name=wg-s2s listen-port=13231
/interface wireguard print2. Head Office:
/ip address add address=10.99.0.1/30 interface=wg-s2s
/interface wireguard peers add interface=wg-s2s public-key="BRANCH_PUBLIC_KEY" allowed-address=10.99.0.2/32,192.168.20.0/24
/ip route add dst-address=192.168.20.0/24 gateway=wg-s2s
/ip firewall filter add chain=input protocol=udp dst-port=13231 action=accept comment="WireGuard" place-before=03. Branch (connects out to Head Office):
/ip address add address=10.99.0.2/30 interface=wg-s2s
/interface wireguard peers add interface=wg-s2s public-key="HEAD_OFFICE_PUBLIC_KEY" endpoint-address=203.0.113.10 endpoint-port=13231 allowed-address=10.99.0.1/32,192.168.10.0/24 persistent-keepalive=25s
/ip route add dst-address=192.168.10.0/24 gateway=wg-s2s4. Allow the LANs to talk. Add wg-s2s to the LAN interface list on both routers, or add forward rules that accept traffic between the two subnets.
Note: Never share private keys. Only the public key is copied to the other router.
Verification
/interface wireguard peers print detail
/ping 192.168.20.1 src-address=192.168.10.1The peer shows a recent last-handshake, and the remote LAN gateway answers.
Common errors
- Public keys swapped or copied with a missing character: no handshake.
allowed-addressmissing the remote LAN: the handshake works but no traffic passes.- UDP 13231 blocked by the firewall or the ISP (CGNAT): put the endpoint on the side with a public IP.
- Masquerade NAT applied to tunnel traffic: limit your masquerade rule to the WAN interface.
Rollback
/interface wireguard disable wg-s2sThis topic is covered hands-on in MTCSE — MikroTik Certified Security Engineer.
View MTCSE