
A MikroTik WireGuard remote-access setup needs an outside UDP path, a peer with the correct key and address ownership, and permission for decrypted traffic to reach its service. Diagnose those boundaries separately: a recent handshake does not establish that a NAS answers HTTPS or that DNS works.
Validation: documentation reviewed November 11, 2026. This is an expanded RouterOS 7 lab example, not a configuration tested on a device. Record the actual router/build, client version, interface ownership and existing policy. It preserves the original article’s private tunnel and NAS addressing. MikroTik is the routed gateway here; the separate OPNsense VPN guide describes a different firewall implementation.
Plan the route as well as the permission
| Role | Chosen value |
|---|---|
| WireGuard interface | wg-remote |
| Router tunnel address | 10.77.0.1/24 |
| Laptop tunnel address | 10.77.0.2/32 |
| Router LAN address | 192.168.50.1/24 |
| NAS HTTPS listener | 192.168.50.100:443 |
| Server-side peer allowed-address | 10.77.0.2/32 |
| UDP listener | 13231 |
| Outside endpoint | vpn.example.com:13231, replace with your controlled endpoint |
Check the tunnel range, LAN and the remote client’s local networks for overlaps. The Subnet Calculator can check a boundary, but only the actual network inventory establishes whether a hotel LAN or another VPN already uses it.
The router’s peer /32 identifies the address behind this laptop’s key.
The laptop’s AllowedIPs chooses which destinations it sends toward the
router. Neither is a substitute for a firewall service policy. The
AllowedIPs explanation
separates destination selection and authenticated source ownership.
The outside endpoint needs reachable inbound UDP, either directly or through an upstream mapping you control. An endpoint hostname does not bypass CGNAT. Use a client outside the home LAN for the first real test and record the actual public endpoint and WAN interface/list.
Prepare one disabled interface and one client identity
Use the safe-change workflow,
retain console access and store protected recovery artifacts off the router.
The interface name, tunnel subnet, port and comments below must be unused.
Do not repeat add commands on an existing configuration.
/interface wireguard add name=wg-remote listen-port=13231 disabled=yes comment="Boxvirt M05 remote-access lab"
/ip address add address=10.77.0.1/24 interface=wg-remote comment="Boxvirt M05 tunnel address"
:put [/interface wireguard get [find where name=wg-remote] public-key]
Generate the client’s own key pair in its installed application. Keep its private key there. Register only its public key on the router; this next line is a placeholder template, not import-ready configuration:
/interface wireguard peers add interface=wg-remote public-key="REPLACE_WITH_CLIENT_PUBLIC_KEY" allowed-address=10.77.0.2/32 disabled=yes comment="Boxvirt M05 laptop"
Each additional client needs a different key pair and unique address. Do not
claim the LAN or 0.0.0.0/0 behind this roaming laptop. Protect generated
client configuration files and QR codes because they can contain private keys.
An interface/peer export does not automatically recreate RouterOS IP addresses,
routes and firewall policy on another router.
Keep client routing split and the negative control meaningful
Replace the keys and endpoint in this client template before importing it:
[Interface]
PrivateKey = REPLACE_WITH_CLIENT_PRIVATE_KEY
Address = 10.77.0.2/32
[Peer]
PublicKey = REPLACE_WITH_ROUTER_PUBLIC_KEY
Endpoint = vpn.example.com:13231
AllowedIPs = 10.77.0.1/32, 192.168.50.100/32, 192.168.50.1/32
PersistentKeepalive = 25
Ordinary internet destinations keep the client’s existing route. The router’s LAN address is deliberately included for a management-denial test: the request must enter the tunnel before its failure can demonstrate the tunnel policy. Having a route to management does not mean granting permission to use it. The tunnel interface address is also routed, but no ping permission is assumed.
Keepalive can retain a NAT mapping during idle periods; it cannot repair a wrong endpoint, key, route or blocked service. There is no DNS field in the initial template. First test the application with a controlled address/name mapping, then add an internal resolver as a separate change.
Review input, forward and the server’s reply path
These candidate permissions are added disabled:
/ip firewall filter add chain=input action=accept in-interface-list=WAN protocol=udp dst-port=13231 disabled=yes comment="Boxvirt M05 WG listener"
/ip firewall filter add chain=forward action=accept in-interface=wg-remote src-address=10.77.0.2/32 dst-address=192.168.50.100 protocol=tcp dst-port=443 disabled=yes comment="Boxvirt M05 NAS HTTPS"
/ip firewall filter add chain=input action=drop in-interface=wg-remote src-address=10.77.0.2/32 disabled=yes comment="Boxvirt M05 no router services"
/ip firewall filter add chain=forward action=drop in-interface=wg-remote src-address=10.77.0.2/32 disabled=yes comment="Boxvirt M05 no other forwarded services"
The encrypted listener uses input. NAS access uses forward. Review actual WAN-list membership, automatic/existing rules, source checks, FastTrack and established/reply handling before placing these candidates. Keep the narrow NAS pass before its catch block; preserve deliberate security decisions earlier in the policy. An existing broad pass can decide the packet before these blocks, so the examples alone do not prove the effective policy.
Do not add wg-remote to a broadly trusted LAN list as a troubleshooting fix.
On the isolated lab router, enable only the reviewed interface, peer and
candidate rules through the retained administration path. Verify a new admin
session remains available.
The NAS uses 192.168.50.1 on this MikroTik as gateway. If it instead uses
another router, that router needs an appropriate return route to the tunnel
subnet. This example adds no source NAT between tunnel and NAS. Masquerading
could hide the laptop’s identity and mask a missing route; review such a
different topology deliberately.
Test one boundary at a time from outside
After sending client traffic, inspect only the needed peer status fields:
:put [/interface wireguard peers get [find where comment="Boxvirt M05 laptop"] last-handshake]
:put [/interface wireguard peers get [find where comment="Boxvirt M05 laptop"] rx]
:put [/interface wireguard peers get [find where comment="Boxvirt M05 laptop"] tx]
:put [/interface wireguard peers get [find where comment="Boxvirt M05 laptop"] current-endpoint-address]
/ip firewall filter print stats where comment~"Boxvirt M05"
/ip route print
Keep configuration exports and unredacted detailed peer output private. For the actual test record, retain public endpoint/route information and counter deltas, not private keys or preshared secrets.
From the laptop, a candidate application request is:
curl --connect-timeout 5 --max-time 15 --resolve app.example.net:443:192.168.50.100 https://app.example.net/
Replace the documentation hostname with one valid for the NAS certificate and trusted by the client. This selects the NAS address without depending on local DNS and preserves TLS name verification. Record known application content, not just an open TCP port or a certificate error.
| Boundary | Evidence to collect |
|---|---|
| Outside UDP path | Attempt reaches the intended listener |
| Peer authentication | Recent handshake for the correct laptop public key |
| Client destination route | NAS and negative-control packets select the tunnel |
| Forward permission | New NAS request matches intended service policy |
| Server and reply | Known HTTPS content; replies return through MikroTik |
| Denied management | New request to 192.168.50.1:443 reaches the tunnel and matches the intended block |
Use a known listening management service as the negative control. A timeout from a stopped server or an overlapping remote LAN is not proof of a firewall denial. Existing connections and FastTrack can complicate counters; start fresh test connections and inspect the identified state without flushing other users.
Diagnose handshake, DNS and larger-transfer failures separately
| Observation | Next checks |
|---|---|
| No handshake after sending traffic | Endpoint resolution/address, UDP mapping, keys, listener and input policy |
| Handshake but no NAS response | Client route, peer /32, forward decision, NAS listener/firewall and return route |
| Correct address test, failed hostname test | Actual client resolver, route to it, its listener and DNS permission |
| Small requests pass, large transfer stalls | Real path MTU, ICMP feedback and TCP behavior |
| Management unexpectedly works | Selected route, earlier input passes, LAN lists and pre-existing state |
For an optional DNS server such as 192.168.50.53, add its exact route to the
client and a reviewed TCP/UDP 53 forward permission before the WG catch block.
Verify the resolver allows the laptop’s tunnel source and has a return path.
If choosing the MikroTik router itself as resolver, that is an input-service
change with its own listener and policy requirements. Do not expose a public
resolver on WAN just to fix VPN DNS.
Changing a client app’s DNS setting may affect more than the selected LAN names. Check the actual platform’s resolver behavior; split traffic routing does not automatically implement split DNS. Likewise, do not select a single universal MTU value without checking the real WAN/tunnel path.
Revoke one laptop and restore the recorded state
Disable this uniquely identified peer and apply the change, then attempt a new tunnel and service connection from the laptop. If immediate revocation needs removal of affected existing state, identify only the relevant lab connections. Keep other clients’ peers and sessions intact.
For rollback, disable the new candidates, peer and interface, restore their recorded predecessors where applicable, and recheck ordinary admin access. For an exposed client private key, replace its key pair and remove the old peer identity. Do not distribute a shared peer identity as a recovery shortcut.
Frequently asked questions
Does a handshake prove the NAS is reachable?
It proves peer authentication on a working outer path at that time. The client route, decrypted forward policy, application listener and reply route still require their own checks.
Should I put the WireGuard interface in the LAN list?
Only if the entire resulting trust policy is intended. This example uses specific input/forward decisions instead of inheriting broad LAN permissions.
Does adding 0.0.0.0/0 make this a working full tunnel?
It changes the client’s destination selection. A full tunnel also needs internet forwarding, the appropriate egress/NAT design, resolver behavior and an explicit IPv6 policy. Those are outside this selected split-tunnel example.
Can these settings carry IPv6 internet traffic?
The listed routes and addresses are IPv4. IPv6 needs its own addresses, peer
ownership, routes and filtering; adding ::/0 alone is not a complete design.
