You do not need to generate keys or build WireGuard peers manually. Your complete MikroTik WireGuard Script (with Private/Public Key, Endpoint, Mangle & Route, and DST-NAT) is ready to copy inside Client Area → My Services → Service Detail. Just click Copy Script and paste into RouterOS v7 New Terminal. The step-by-step guide below remains available as a reference.
Introduction
WireGuard runs natively in the MikroTik RouterOS v7 kernel, delivering lower latency, higher throughput, instant handshakes, and minimal CPU load compared to legacy VPN protocols.
Note: Requires RouterOS v7 or newer. For RouterOS v6 routers, please follow our L2TP/SSTP guide.
Method 1: 1-Click Auto Script (Recommended)
- Log in to the Mozfactor Client Area and open your WireGuard Service Detail page.
- Click Copy Script under the MikroTik Terminal Script (v7) tab.
- Open WinBox → New Terminal, paste the script, and press Enter.
- If routing local servers through the Public IP, also paste the WireGuard Mangle & Route Script from the same page.
Method 2: Manual Step-by-Step Setup
1. Create the WireGuard Interface
/interface wireguard
add name=wg-mozfactor listen-port=13231 mtu=1420 private-key="YOUR_PRIVATE_KEY"
2. Assign the Tunnel IP Address
/ip address
add address=YOUR_TUNNEL_IP/24 interface=wg-mozfactor
3. Add the Mozfactor Server Peer
/interface wireguard peers
add interface=wg-mozfactor public-key="SERVER_PUBLIC_KEY" endpoint-address=SERVER_HOST endpoint-port=SERVER_PORT allowed-address=0.0.0.0/0 persistent-keepalive=25s
4. Enable NAT Masquerade (Optional for Outbound LAN Traffic)
/ip firewall nat
add chain=srcnat action=masquerade out-interface=wg-mozfactor src-address=192.168.88.0/24
5. Configure DNS Servers
/ip dns
set servers=8.8.8.8,1.1.1.1 allow-remote-requests=yes
Verification
- Open WireGuard → Peers in WinBox and verify that Last Handshake updates within seconds and Rx / Tx counters increase.
- Check the live telemetry card on your Client Area Service Detail page — it should show Connected (Online).