WireGuard is a modern VPN that is built into RouterOS 7. It is fast, has a short configuration and uses a small amount of CPU. In this guide you will set up a simple “road warrior” VPN: your phone or laptop connects to your home MikroTik router, and gets a secure connection to your home network and, if you want, a way to browse through your home internet connection.
What you need
- A router running RouterOS 7 or newer. WireGuard is not available in RouterOS 6.
- A public IP address on the router’s WAN side, or a port forward from the upstream device. If your provider puts you behind carrier-grade NAT, incoming connections will not reach the router.
- A WireGuard app on the client device (available for phones and computers).
- The baseline firewall from our MikroTik firewall guide, or a similar one. The commands below assume an interface list called
LAN.
The addresses and names in this article are examples. Replace them with your own, and always keep a backup and use Safe Mode before changing the firewall.
Step 1: Create the WireGuard interface
RouterOS generates the key pair for you when you create the interface:
/interface wireguard
add name=wg0 listen-port=13231 comment="WireGuard server"
/interface wireguard print
The print output shows the interface’s public key. Copy it, because the client needs it. The private key stays on the router and must never be shared.
Step 2: Give the tunnel an address
/ip address
add address=10.10.10.1/24 interface=wg0 comment="WireGuard network"
This is a separate small network just for VPN clients. The router is 10.10.10.1, and the first client will be 10.10.10.2.
Step 3: Create the client and add it as a peer
In the WireGuard app on your phone or computer, create a new empty tunnel. The app generates a key pair. Copy the client’s public key, then add it on the router:
/interface wireguard peers
add interface=wg0 public-key="CLIENT_PUBLIC_KEY" allowed-address=10.10.10.2/32 comment="my phone"
The allowed-address tells the router which source address this peer is allowed to use. Keep it as a single /32 address per client.
Step 4: Open the firewall
Allow the WireGuard UDP port from the internet, and treat the tunnel as part of your LAN so that VPN clients can reach the router and the local network:
/ip firewall filter
add chain=input action=accept protocol=udp dst-port=13231 comment="allow WireGuard" \
place-before=[find where comment="drop everything not from LAN"]
/interface list member
add list=LAN interface=wg0
The rule must sit above the rule that drops everything not coming from the LAN. If your drop rule has a different comment, change the name in the command. If your router is behind another router, forward UDP port 13231 to it there as well.
Step 5: Configure the client
In the client app, the configuration looks like this:
[Interface]
PrivateKey = CLIENT_PRIVATE_KEY
Address = 10.10.10.2/32
[Peer]
PublicKey = ROUTER_PUBLIC_KEY
Endpoint = YOUR_PUBLIC_IP_OR_DDNS_NAME:13231
AllowedIPs = 192.168.88.0/24, 10.10.10.0/24
PersistentKeepalive = 25
AllowedIPsdecides what goes through the tunnel. With your home subnet and the VPN subnet (as above), only traffic to home uses the VPN. This is called a split tunnel. Use0.0.0.0/0to send all traffic through your home connection.PersistentKeepalivekeeps the connection alive through NAT on mobile networks.- Replace
192.168.88.0/24with your own LAN subnet.
If your public IP changes
Many home connections have a dynamic IP. MikroTik has a free dynamic DNS service you can enable on the router:
/ip cloud set ddns-enabled=yes
/ip cloud print
The output shows a DNS name for your router. Use that name as the Endpoint in the client instead of the IP address.
Check that it works
- Switch the tunnel on in the client app.
- On the router, run
/interface wireguard peers printand look for a recent handshake time. - From the client, ping
10.10.10.1, then a device in your LAN.
Troubleshooting
- No handshake: check the keys (a swapped or mistyped key is the most common cause), the endpoint address and port, and that the input rule is above the drop rule.
- Handshake works but nothing responds: check
allowed-addresson the router,AllowedIPson the client, and thatwg0is in the LAN list. - Works on Wi-Fi but not on mobile data: your mobile provider may block or filter UDP traffic on that port. Try another port.
- Some sites load slowly or hang: a packet size (MTU) problem. Try reducing the MTU on the tunnel interface.
- No public IP: you are behind carrier-grade NAT. Ask the provider for a public address, or run the VPN through a small server with a public IP.
Security tips
- Never share private keys, and do not post configs with real keys.
- Use one peer per device, so you can remove a single lost device without touching the others.
- Peers support an optional preshared key for extra protection.
- Remove peers you no longer use.
Checklist
- RouterOS 7 or newer, and a public IP or a port forward.
- WireGuard interface, address and peer created.
- Firewall rule above the drop rule, and
wg0in the LAN list. - Client configured with the router’s public key and the correct endpoint.
- Handshake and ping tested from outside your home network.

