WireGuard UI for MikroTik
Run a web-based dashboard on a Raspberry Pi or Ubuntu server to manage WireGuard peers on your MikroTik router — add clients, generate QR codes, and set data limits from a browser.
What This Guide Sets Up
RouterOS has WireGuard built in, but managing peers (adding VPN clients, generating QR codes, setting data limits) requires using the terminal or Winbox. MTWireGuard is an open-source web UI that connects to RouterOS via its API and provides a proper dashboard to manage everything from a browser.
WireGuard runs natively on the MikroTik — MTWireGuard is just the management interface, running on a separate Pi or Ubuntu machine on your LAN.
Your phone / laptop (away from home)
│ encrypted WireGuard UDP traffic (port 13231)
▼
MikroTik Router — WireGuard runs natively here
│
└──► Your home LAN (192.168.88.0/24)
│
└──► Pi / Ubuntu server running MTWireGuard UI
You access the dashboard at http://192.168.88.50:8080 from inside your LAN
MTWireGuard talks to RouterOS REST API on port 80 to manage peers
Prerequisites
Part 1 — Set Up WireGuard in RouterOS
WireGuard is built into RouterOS — we just need to create and configure the interface. This is the actual VPN server your devices will connect to.
Create a WireGuard interface. RouterOS will automatically generate the public/private key pair:
/interface/wireguard/add name=wireguard1 listen-port=13231
Note down the public key — you’ll need it when configuring client devices:
/interface/wireguard/print
Give the WireGuard interface its own subnet. VPN clients will be assigned addresses from this range:
/ip/address/add address=10.0.0.1/24 interface=wireguard1
Create an IP pool so MTWireGuard can auto-assign addresses to new peers:
/ip/pool/add name=wireguard-pool ranges=10.0.0.2-10.0.0.254
Allow incoming WireGuard connections and let VPN clients reach your LAN:
# Allow WireGuard UDP traffic in /ip/firewall/filter/add \ chain=input \ protocol=udp \ dst-port=13231 \ action=accept \ comment="WireGuard VPN" # Allow VPN clients to forward traffic to the LAN /ip/firewall/filter/add \ chain=forward \ in-interface=wireguard1 \ action=accept \ comment="WireGuard to LAN" # Masquerade VPN traffic so it appears to come from the router /ip/firewall/nat/add \ chain=srcnat \ src-address=10.0.0.0/24 \ action=masquerade
MTWireGuard uses the RouterOS REST API over HTTP — not the legacy API port. Enable the www service and create a dedicated user:
# Enable the www (HTTP REST API) service on port 80 /ip/service/enable www # Create a dedicated user for MTWireGuard (don't reuse your admin account) /user/add name=mtwireguard \ password="your-strong-password" \ group=full
80 (www service), not the legacy API on port 8728. Make sure www shows as enabled in /ip/service/print. You can also use www-ssl on port 443 if you have a certificate configured, but www on port 80 is simpler for a local home setup.
/ip/service/set www address=192.168.88.50/32
Enable MikroTik’s built-in DDNS service so you always have a hostname pointing to your current public IP — this is what remote VPN clients will connect to:
/ip/cloud/set ddns-enabled=yes
# Check your assigned hostname
/ip/cloud/print
Your hostname will look like abc123.sn.mynetname.net — note it down for use in Step 7.
/ip/address/print matches the public IP shown at a site like whatismyip.com. If they differ, contact your ISP or consider a Cloudflare Tunnel as an alternative.
Part 2 — Install Docker on Your Pi or Ubuntu Server
If Docker is already installed, skip to Step 7.
Run the official Docker install script — this works on both Raspberry Pi OS and Ubuntu:
# Download and run the official Docker install script curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh # Add your user to the docker group so you don't need sudo every time sudo usermod -aG docker $USER # Apply the group change without logging out newgrp docker # Verify Docker is working docker --version
arm32v7 image tag instead of latest in Step 7.
Part 3 — Run MTWireGuard
Run the following command. The values below are pulled from the settings panel near the top of this guide — fill those in first, then hit Copy.
sudo docker run -d \ --name mtwireguard \ --restart unless-stopped \ -p 8080:8080 \ -v ./mtwg-data:/app/storage \ -e MT_IP="192.168.88.1" \ -e MT_PORT="80" \ -e MT_USER="mtwireguard" \ -e MT_PASS="your-strong-password" \ -e MT_PUBLIC_IP="your-public-ip-or-ddns" \ techgarageir/mtwireguard:latest
| Variable | What to put here |
|---|---|
MT_IP | Your MikroTik’s LAN IP — check with /ip/address/print on RouterOS |
MT_PORT | 80 for www (HTTP) or 443 for www-ssl (HTTPS) |
MT_USER | The MikroTik user created in Step 4 (e.g. mtwireguard) |
MT_PASS | The password you set for that user in Step 4 |
MT_PUBLIC_IP | Your public IP or MikroTik DDNS hostname — check with /ip/cloud/print |
http://192.168.88.50:8080
Because WireGuard runs natively on RouterOS, the firewall rule from Step 3 already allows incoming traffic on port 13231. The only additional step needed is if you have a separate modem or upstream router between the MikroTik and the internet — in that case, also forward UDP 13231 on that device pointing to the MikroTik’s WAN IP.
Logging Into the Dashboard
Open http://192.168.88.50:8080 in a browser on your LAN. You’ll be presented with a login screen.
For example, if you created a user called
mtwireguard with password your-strong-password, those are the credentials you log in with here.
Adding Your First VPN Client (Peer)
A “peer” is a device you want to connect to your home network via VPN — a phone, laptop, or anything else running the WireGuard app. Here’s how to add one:
In the MTWireGuard dashboard, click the + Add Peer button. Fill in the details:
- Name: something descriptive — e.g.
Johns-iPhoneorWork-Laptop - Allowed IPs: leave as
0.0.0.0/0to route all traffic through the VPN, or set to192.168.x.x/24(your home LAN subnet) if you only want LAN access - DNS: optionally set to your router’s LAN IP (e.g.
10.2.0.125) or a public DNS like1.1.1.1 - Expiry / Data limit: leave blank for permanent access, or set limits for guest access
Click Save. MTWireGuard will automatically generate a key pair and add the peer to RouterOS.
Install the WireGuard app on your phone (free on iOS App Store and Google Play). Then:
- In MTWireGuard, find your new peer in the list and click the QR code icon
- In the WireGuard app on your phone, tap the + button and choose Scan QR Code
- Point your camera at the QR code on screen — the tunnel config is imported automatically
- Give the tunnel a name and tap Add Tunnel
- Toggle the tunnel on — you should be connected
Install the WireGuard app on your computer from wireguard.com/install. Then:
- In MTWireGuard, find your peer and click the download config icon to save a
.conffile - Open the WireGuard app on your computer and click Import tunnel(s) from file
- Select the downloaded
.conffile - Click Activate to connect
Dashboard Reference
Other things you can do from the MTWireGuard dashboard:
| Task | How |
|---|---|
| Add a VPN client (peer) | Click Add Peer — MTWireGuard auto-assigns an IP from the pool |
| Connect a phone | Click the QR code icon next to the peer — scan with the WireGuard mobile app |
| Connect a laptop | Download the config file and import it into the WireGuard desktop app |
| Set a data limit | Edit the peer and set a traffic limit — peer is disabled when reached |
| Set an expiry date | Edit the peer and set an expiration — useful for giving temporary guest access |
| View usage | Dashboard shows data transferred per peer |
| Remove a peer | Delete from dashboard — MTWireGuard removes it from RouterOS automatically |
Quick Reference
| Item | Value / Command |
|---|---|
| MTWireGuard dashboard | http://192.168.88.50:8080 |
| Dashboard login | MikroTik username & password set in Step 4 |
| WireGuard VPN port | UDP 13231 |
| WireGuard subnet | 10.0.0.0/24 |
| RouterOS REST API port | 80 (www service) |
| Check MikroTik DDNS hostname | /ip/cloud/print (RouterOS) |
| View container logs | sudo docker logs mtwireguard |
| Stop the UI | sudo docker stop mtwireguard |
| Start the UI | sudo docker start mtwireguard |
| Remove container (to recreate) | sudo docker stop mtwireguard && sudo docker rm mtwireguard |
| Update to latest version | sudo docker pull techgarageir/mtwireguard:latest then re-run the docker run command |
| Check WireGuard peers (RouterOS) | /interface/wireguard/peers/print |
Troubleshooting
Dashboard won’t load
Check the container started correctly:
sudo docker logs mtwireguard
The most common cause is incorrect credentials or the wrong MikroTik IP/port in the environment variables. Double-check everything from Step 7, then stop, remove, and recreate the container:
sudo docker stop mtwireguard
sudo docker rm mtwireguard
# Then re-run the docker run command from Step 7 with corrected values
Login says invalid credentials
MTWireGuard does not have its own user database — it uses your MikroTik credentials. Log in with the username and password of the MikroTik user you created in Step 4 (e.g. username mtwireguard). Do not use admin/admin or any other defaults.
MTWireGuard can’t connect to RouterOS API
Confirm the API service is running and the user exists:
# Check API service is enabled /ip/service/print # Confirm the user exists /user/print
If you restricted the API to a specific IP in Step 4, make sure the IP matches your Pi/Ubuntu server’s current LAN IP.
VPN connects but can’t reach LAN devices
Make sure the masquerade NAT rule and forward filter rule from Step 3 are in place:
/ip/firewall/filter/print /ip/firewall/nat/print
Can’t connect from outside the home network
Verify UDP port 13231 is reachable from the internet. Check that your DDNS hostname resolves to your current public IP. If your ISP uses CGNAT (the WAN IP on your router doesn’t match whatismyip.com), standard port forwarding won’t work — contact your ISP to request a public IP, or look into Cloudflare Tunnel as an alternative.
Peers added in MTWireGuard don’t appear in Winbox
This is normal — give it a few seconds. MTWireGuard writes peers directly to RouterOS via the API, so they will appear in Winbox under WireGuard > Peers once the API call completes. Refresh the Winbox view.
Uses MTWireGuard (MIT licence) · WireGuard is built into RouterOS v7+ · Guide last updated June 2026



