WireGuard is a modern, streamlined VPN protocol that is gaining popularity due to its speed, security, and ease of use. If you own a MikroTik router, you’re in luck – setting up a WireGuard VPN is a relatively straightforward process.

How to Set Up WireGuard on Your MikroTik Router

Before you begin, you’ll need the following:

  • A MikroTik router with RouterOS installed.
  • A WireGuard client for your device (Windows, macOS, Linux, Android, iOS).
  • A WireGuard configuration file (if using a third-party VPN provider).

Steps to Configure WireGuard on MikroTik

  1. Create a WireGuard Interface
  • Open Winbox and connect to your MikroTik router.
  • Navigate to Interfaces and click the plus sign (+) to add a new interface.
  • Select WireGuard as the interface type and give it a descriptive name (e.g., “WireGuardVPN”).
  • Click Apply and OK. This will generate a private key and public key for your router.
  1. Assign an IP Address
  • Navigate to IP > Addresses.
  • Click the plus sign (+) and assign an IP address to your WireGuard interface (e.g.,
  • Click Apply and OK.
  1. Add WireGuard Peers
  • Go back to Interfaces and double-click your WireGuard interface.
  • Navigate to the Peers tab and click the plus sign (+).
  • Enter the following information:
    • Public Key: The public key of your WireGuard client or VPN provider.
    • Allowed IPs: The IP address(es) you want to allow through the VPN tunnel (e.g., for a single client).
  • Click Apply and OK.
  1. Configure Firewall (Optional)
  • If you want to route all internet traffic through the VPN, you’ll need to adjust your firewall settings. Consult the MikroTik documentation for specific instructions.

Configuring Your WireGuard Client

Configuration on your device will depend on your chosen WireGuard client. However, the general process involves:

  1. Generate a key pair: Your client will usually have this feature built-in.
  2. Create a Configuration: The client will provide a way to create a new configuration. Enter the following information:
  • Address: An IP address within the WireGuard subnet you created on your router.
  • Private Key: Your client’s private key.
  • Public Key: Your MikroTik router’s public key.
  • Endpoint: Your MikroTik router’s external IP address or domain name, and the WireGuard port you configured.

Example Configuration Table

SettingRouter (MikroTik)Client
Interface TypeWireGuardWireGuard
IP Address10.10.10.1/2410.10.10.2/32
Private Key(Auto-generated by MikroTik)(Auto-generated by the client)
Public Key(Displayed in interface settings)(Copied from the router)
Allowed IPsIP range for clients (e.g.,’s IP address within the configured range
EndpointRouter’s external IP address or domain name + WireGuard port(Same as router’s endpoint)

Remember to save your configurations on both the router and your client. Once connected, your traffic should be securely tunneled through the WireGuard VPN!

Setting Up WireGuard VPN on MikroTik

Creating a secure and efficient VPN setup on your MikroTik router is straightforward with WireGuard. This guide will take you through the necessary steps to get your VPN up and running.

Preparing for Installation

Before diving into the WireGuard installation, ensure you have access to your MikroTik router with the necessary permissions. Familiarize yourself with RouterOS, as it is the platform on which you’ll configure WireGuard. You’ll also need to have an updated RouterOS to ensure compatibility.

Installing WireGuard on RouterOS

To install WireGuard, access your MikroTik router’s interface, typically through Winbox or the web console. WireGuard can be installed by navigating to the ‘Packages’ section and enabling the WireGuard feature. This action may require a system reboot to complete the installation.

Creating WireGuard Interface

Once WireGuard is installed, create a new WireGuard interface:

  1. Access the ‘Interfaces’ menu.
  2. Click on the ‘Plus’ sign to add a new interface.
  3. Select WireGuard from the list.
  4. Assign a name to your new WireGuard interface such as wireguard1.

A typical WireGuard interface configuration entails specifying an IP address. For example, the WireGuard interface could be assigned if you’re setting up a separate network for VPN-connected clients.

Configuring WireGuard Peers

Peer configuration is crucial in establishing a secure connection. Follow these steps to add and configure peers:

  1. Generate a public and private key pair within the WireGuard interface settings.
  2. Add a new peer by specifying their public key and setting up a list of allowed addresses they can connect from.
  3. Input the corresponding IP address that the peer will use in the VPN.
  4. Establish the route that directs traffic to the secure tunnel, ensuring all data exchanged is encrypted.

WireGuard’s lightweight setup allows for quick configuration changes and adaptation, enabling a secure connection between the MikroTik router serving as a VPN server and the connecting clients or peers.

Network and Firewall Configuration for VPN

When configuring MikroTik for a WireGuard VPN, it’s important to ensure secure connection routing and network protection. This involves setting up NAT and firewall rules, managing IP routes, and handling DNS and IP addresses effectively.

Setting Up NAT and Firewall Rules

NAT (Network Address Translation) helps in translating your private IP addresses into a single public address on the WAN. Ensure masquerade is enabled for the WAN interface to allow internet traffic from your VPN to flow correctly. Configuring the firewall to secure the connection involves creating rules that specify which traffic is allowed. Make sure to permit only the necessary endpoint ports for WireGuard and block unwanted access. Here’s a simple example:

/ip firewall filter
add chain=input protocol=udp port=51820 action=accept comment="Allow WireGuard"
add chain=input action=drop in-interface=!WAN comment="Drop all other from WAN"

Defining IP Routes

IP routes direct the traffic coming from the VPN to the right places in your network. Set a gateway to specify where the traffic should go after it reaches your MikroTik router. For a site-to-site VPN, routes must ensure that traffic reaches the correct local and remote subnets. An allowed-address in the WireGuard peer configuration ensures correct routing between the peers.

/ip route
add dst-address= gateway= comment="Route to remote network"

DNS and IP Address Management

DNS settings are crucial for name resolution within your network and for your VPN users to reach internet services. Configure the MikroTik router to either use your ISP’s DNS or another trusted DNS provider. Managing IP addresses within your home network is often done through DHCP, making it easier to assign IPs and manage DNS for client devices. Ensure your VPN’s DHCP settings allow secure connection and provide the necessary gateway and subnet to your clients.

/ip dhcp-server network
add address= gateway= dns-server=

Configuring your network for VPN use requires attention to detail and a clear understanding of your security needs. By taking these steps, you can achieve a functional and protected VPN environment.

Client Setup and Connectivity

Configuring your MikroTik router to connect through a VPN enhances privacy and security. Setting up a WireGuard VPN client on MikroTik RouterOS 7 can be straightforward if you follow precise instructions. WireGuard offers a simpler and faster alternative to traditional VPNs like OpenVPN. Its lean design enables users to establish secure point-to-point connections for remote offices and roadwarrior scenarios such as connecting from hotels or coffee shops.

Configuring WireGuard on Client Devices

When setting up WireGuard as a VPN client, you must first ensure your MikroTik router runs on RouterOS 7 or later. It’s crucial to gain access to the router’s admin interface via Winbox or a similar management tool. Create a virtual interface for the WireGuard connection on your MikroTik router. This involves specifying Allowed IPs which dictates the traffic allowed through the VPN.

For instance, if you’re configuring a roadwarrior setup, create a peer representing the VPN server. In this peer’s settings, you’ll need to add the server’s public key and set the Endpoint to the server’s IP address and port.

On client devices such as Windows, Linux, Android, or iOS, installing the WireGuard application available from their respective app stores or websites is needed. After installing the application, import the client configuration file provided by your MikroTik router or manually input the necessary Peer information, including public and private keys, and set Allowed IPs.

During setup, Windows users might prefer to use port 443 as it’s typically not blocked by firewalls, whereas MikroTik’s default port is 13231. Remember that WireGuard operates over UDP protocol, renowned for its speed.

Finally, ensure DNS servers are configured on the client devices for proper name resolution when connected to the VPN.

Troubleshooting Connection Issues

If you encounter connection problems after setting up your WireGuard VPN client, go through a systematic process to identify and resolve them.

  1. Ping Test: Check if your MikroTik router can ping the WireGuard server’s IP address.
  2. Cryptography Check: Verify the cryptographic keys (public and private keys) to ensure they are correctly configured on both the client and server ends.
  3. Persistent Keepalive: If your client is behind a NAT, setting the persistent-keepalive may be necessary to maintain the connection.
  4. Firewall Settings: Inspect any firewall rules that may be blocking VPN traffic and adjust them as needed.
  5. Client Configuration: Re-examine the client config to ensure the endpoint IP addresses, allowed subnets, and keys match those expected by the server.
  6. Subnet Overlap: Confirm there’s no overlap between your local LAN subnets and the VPN’s internal subnets which might cause routing conflicts.

If issues persist, consulting the detailed MikroTik logs can provide further clues. It’s also beneficial to seek support from the MikroTik community or professional networking consultants if you’re in over your head.

Frequently Asked Questions

This section covers common inquiries about setting up and using WireGuard VPN on MikroTik routers for various scenarios.

How do I configure a WireGuard server on MikroTik for secure VPN connections?

To set up a WireGuard server on MikroTik, ensure you’re running RouterOS 7 or newer. Enable the WireGuard package and create a WireGuard interface. Assign it an IP address and configure peers with their public keys and allowed IPs.

What are the steps for setting up a MikroTik router as a WireGuard VPN client?

For a MikroTik router to act as a WireGuard client, first update RouterOS to version 7.6 or higher. Next, establish a WireGuard interface and specify the VPN server details. Add the server’s public key to the peer list and set up the allowed IPs to secure the connection.

Can I establish a site-to-site VPN with WireGuard on MikroTik routers, and if so, how?

Yes, site-to-site VPNs are viable using WireGuard on MikroTik routers. Start by configuring WireGuard interfaces on both routers. Set up each as a peer on the other, ensuring proper routing of IP addresses between sites for a secure direct connection.

What is the process for configuring WireGuard VPN on MikroTik for mobile devices such as Android and iOS?

To configure WireGuard VPN for mobile devices, create a dedicated WireGuard interface on your MikroTik router. Provide mobile devices with configuration details, including the server’s public key and assigned IP. Use the respective device’s WireGuard app to finalize the setup.

Is there a tutorial for implementing a WireGuard road warrior VPN setup on MikroTik?

For a road warrior setup, which allows remote users to connect to a network, create a WireGuard interface on your MikroTik router. Configure peers for each remote user, providing them with necessary credentials. Detailed guides are available on the MikroTik documentation site.

Where can I find the official download for the MikroTik WireGuard package?

The official MikroTik WireGuard package can be downloaded from the MikroTik website. Navigate to the download section and select the relevant RouterOS version. The package is typically enabled by default in RouterOS version 7 and above.

Similar Posts