WireGuard UI for MikroTik

MikroTik RouterOS · WireGuard · MTWireGuard UI

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.

WireGuardBuilt into RouterOS — handles the actual VPN tunnels. No extra package needed.
MTWireGuard UIRuns on your Pi / Ubuntu server. Connects to RouterOS via API to manage peers.
Use caseSecurely access your home network from anywhere — phone, laptop, while travelling.
Key featuresAdd/remove peers, generate QR codes, set data limits, expiry dates, auto-assign IPs.
HOW IT ALL FITS TOGETHER

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

⚙ Your Setup Details
Fill in your own values below — every code block in this guide will update automatically. Use the Copy button on each code block to copy the ready-to-paste version.

Prerequisites

MikroTikRouterOS v7.15 or later
UI serverRaspberry Pi (any model with 1GB+ RAM) or Ubuntu 22.04/24.04
DockerInstalled on your Pi / Ubuntu server
NetworkPi / Ubuntu server on the same LAN as the MikroTik
Domain / DDNSNeeded for remote VPN access (optional for LAN-only testing)

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.

1
Create the WireGuard Interface

Create a WireGuard interface. RouterOS will automatically generate the public/private key pair:

RouterOS terminal
/interface/wireguard/add name=wireguard1 listen-port=13231

Note down the public key — you’ll need it when configuring client devices:

RouterOS terminal
/interface/wireguard/print
2
Assign an IP to the WireGuard Interface

Give the WireGuard interface its own subnet. VPN clients will be assigned addresses from this range:

RouterOS terminal
/ip/address/add address=10.0.0.1/24 interface=wireguard1

Create an IP pool so MTWireGuard can auto-assign addresses to new peers:

RouterOS terminal
/ip/pool/add name=wireguard-pool ranges=10.0.0.2-10.0.0.254
3
Configure Firewall Rules

Allow incoming WireGuard connections and let VPN clients reach your LAN:

RouterOS terminal
# 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
4
Enable the RouterOS API and Create an API User

MTWireGuard uses the RouterOS REST API over HTTP — not the legacy API port. Enable the www service and create a dedicated user:

RouterOS terminal
# 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
ℹ Note: MTWireGuard connects to the REST API on port 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.
ℹ Security tip: Restrict the www service to only your server’s IP so it isn’t accessible from other LAN devices:

/ip/service/set www address=192.168.88.50/32
5
Set Up DDNS (if you don’t have a static public IP)

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:

RouterOS terminal
/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.

ℹ CGNAT check: If your ISP uses CGNAT, you won’t have a real public IP and remote access won’t work with standard port forwarding. Check whether the WAN IP shown in /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.

6
Install Docker

Run the official Docker install script — this works on both Raspberry Pi OS and Ubuntu:

Pi / Ubuntu terminal (bash)
# 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
ℹ Raspberry Pi note: This works on Pi 3, 4, and 5 running Raspberry Pi OS (64-bit recommended). If you’re on 32-bit Raspberry Pi OS, use the arm32v7 image tag instead of latest in Step 7.

Part 3 — Run MTWireGuard

7
Run the MTWireGuard Container

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.

Pi / Ubuntu terminal (bash)
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
VariableWhat to put here
MT_IPYour MikroTik’s LAN IP — check with /ip/address/print on RouterOS
MT_PORT80 for www (HTTP) or 443 for www-ssl (HTTPS)
MT_USERThe MikroTik user created in Step 4 (e.g. mtwireguard)
MT_PASSThe password you set for that user in Step 4
MT_PUBLIC_IPYour public IP or MikroTik DDNS hostname — check with /ip/cloud/print
✓ Dashboard will be available at: http://192.168.88.50:8080
8
Forward WireGuard Port on Your Router

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.

ℹ Tip: You do not need to forward port 8080 on your router. The MTWireGuard dashboard is only accessible from inside your LAN, which is intentional — you wouldn’t want it exposed to the internet.

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.

ℹ MTWireGuard uses your MikroTik credentials to log in — there is no separate MTWireGuard username and password. Use the same username and password you set when creating the user on the MikroTik in Step 4.

For example, if you created a user called mtwireguard with password your-strong-password, those are the credentials you log in with here.
✓ Once logged in you’ll see the MTWireGuard dashboard showing your WireGuard interface, connected peers, and traffic stats.

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:

1
Create the Peer

In the MTWireGuard dashboard, click the + Add Peer button. Fill in the details:

  • Name: something descriptive — e.g. Johns-iPhone or Work-Laptop
  • Allowed IPs: leave as 0.0.0.0/0 to route all traffic through the VPN, or set to 192.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 like 1.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.

2
Connect a Phone

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
ℹ Test on mobile data: Turn off your phone’s Wi-Fi and enable the VPN tunnel on mobile data. If you can browse to devices on your home LAN, everything is working correctly.
3
Connect a Laptop or Desktop

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 .conf file
  • Open the WireGuard app on your computer and click Import tunnel(s) from file
  • Select the downloaded .conf file
  • 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

ItemValue / Command
MTWireGuard dashboardhttp://192.168.88.50:8080
Dashboard loginMikroTik username & password set in Step 4
WireGuard VPN portUDP 13231
WireGuard subnet10.0.0.0/24
RouterOS REST API port80 (www service)
Check MikroTik DDNS hostname/ip/cloud/print (RouterOS)
View container logssudo docker logs mtwireguard
Stop the UIsudo docker stop mtwireguard
Start the UIsudo docker start mtwireguard
Remove container (to recreate)sudo docker stop mtwireguard && sudo docker rm mtwireguard
Update to latest versionsudo 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:

Pi / Ubuntu terminal (bash)
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:

Pi / Ubuntu terminal (bash)
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:

RouterOS terminal
# 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:

RouterOS terminal
/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

Leave a Comment

Your email address will not be published. Required fields are marked *