Personal tools
Namespaces

Variants
Actions

MikroTik WireGuard VPN For WHMCS

From ModulesGarden Wiki
(Difference between revisions)
Jump to: navigation, search
Line 530: Line 530:
 
</div>
 
</div>
 
|}
 
|}
==Tips==
+
=Tips=
 
{|
 
{|
 
|style="padding: 10px 0px 10px 15px;"|'''1.''' Use HTTPS and restrict RouterOS API access to the IP address of your WHMCS server.
 
|style="padding: 10px 0px 10px 15px;"|'''1.''' Use HTTPS and restrict RouterOS API access to the IP address of your WHMCS server.
Line 547: Line 547:
 
|}
 
|}
  
==Update Instructions==
+
=Update Instructions=
 +
{|
 +
|style="padding: 10px 0px 30px 15px;"|
 
An essential guidance through the module update process can be found [https://www.docs.modulesgarden.com/How_To_Upgrade_WHMCS_Module here].
 
An essential guidance through the module update process can be found [https://www.docs.modulesgarden.com/How_To_Upgrade_WHMCS_Module here].
  
Line 553: Line 555:
 
'''Important:''' Before updating the module, create a backup of the WHMCS files and database. Review the module changelog for version-specific requirements and migration notes.
 
'''Important:''' Before updating the module, create a backup of the WHMCS files and database. Review the module changelog for version-specific requirements and migration notes.
 
</div>
 
</div>
 
+
|}
==Common Problems==
+
=Common Problems=
 
{|
 
{|
 
|style="padding: 10px 0px 5px 15px;"|'''1. The connection test fails.'''
 
|style="padding: 10px 0px 5px 15px;"|'''1. The connection test fails.'''

Revision as of 14:09, 30 July 2026

This documentation is still being prepared. Please allow us a little more time to polish and publish the complete article.
Thank you for your patience!

Contents

About MikroTik WireGuard VPN For WHMCS

MikroTik WireGuard VPN For WHMCS enables automated provisioning and management of WireGuard VPN services on MikroTik routers.

The module creates VPN peers, assigns tunnel IP addresses, applies bandwidth limits, and tracks traffic usage directly through WHMCS.
Clients can access their connection details, scan a configuration QR code, download a ready-to-use configuration file, and review traffic statistics in the client area.

  • Core Features:
✔ Automate Complete WireGuard VPN Service Provisioning
✔ Manage VPN Accounts On MikroTik Routers Through WHMCS
✔ Control Bandwidth And Track Traffic Usage
✔ Provide Clients With Ready-To-Use VPN Configurations
✔ Support Usage-Based Billing For Transferred Traffic
  • Admin Area:
✔ Create, Suspend, Unsuspend And Terminate VPN Accounts
✔ Change Service Packages
✔ View Peer And Connection Details
✔ Download VPN Configuration Files
✔ View Daily And Monthly Traffic Statistics
✔ Reset VPN Connections
✔ Configure Products:
✔ Select MikroTik Server And WireGuard Interface
✔ Define Peer Comment Prefix
✔ Configure Allowed IP Addresses And DNS Servers
✔ Set Keepalive Interval
✔ Define Upload And Download Speed Limits
✔ Enable Traffic Statistics
✔ Configure Traffic Data Retention Period
✔ Define Setup Guide And WireGuard Client Download URLs
✔ Enable Usage-Based Metric Billing
  • Addon Module:
✔ View Dashboard With Server, Account And Service Summaries
✔ View General Traffic Overview Graph
✔ Manage Multiple MikroTik Servers
✔ View All WireGuard VPN Accounts And Peers
✔ Preview Peer State, Interface, Last Handshake And Traffic Usage
✔ View Connection Details And Configuration
✔ Control Staff Access Level To Specific Resources With ACL
✔ Customize Module Language Files With "Translations" Tool
✔ Review Module Activity And Error Logs
  • Client Area:
✔ View VPN Account And Connection Status
✔ View Connection Details And Assigned Tunnel IP Address
✔ Check Applied Bandwidth Limits
✔ Preview WireGuard Configuration
✔ Scan Configuration QR Code
✔ Download Ready-To-Use .conf File
✔ View Daily And Monthly Traffic Statistics
✔ Reset VPN Connection
✔ Access Setup Guide
✔ Download WireGuard Client
  • General Info:
✔ Supports MikroTik RouterOS 7.20 And Later
✔ Supports Multiple MikroTik Routers
✔ Multi-Language Support With Custom Translations Tool
✔ Supports PHP 8.3 Back To PHP 8.2
✔ Supports WHMCS Themes "Six", "Twenty-One", "Nexus" And "Lagom WHMCS Client Theme"
✔ Supports WHMCS V9.X
✔ Requires ionCube Loader V14 Or Later
✔ Easy Module Upgrade To Open Source Version

Installation and Configuration

This tutorial will show you how to successfully install and configure MikroTik WireGuard VPN For WHMCS.
We will guide you step by step through the installation process, MikroTik server connection, product configuration, metric billing setup, addon module management, and client area features.

Installation

1. Extract the module package into the main WHMCS directory.

The files should be uploaded into the corresponding WHMCS folders.

MTWG 1.png
2. Log in to your WHMCS admin area and navigate to System SettingsAddon Modules.

Find MikroTik WireGuard VPN on the list and click Activate.

File:MTWG 2.png
3. Set access permissions for the required administrator roles and save the changes.

The addon module can now be opened through AddonsMikroTik WireGuard VPN.

MTWG 3.png

MikroTik Router Preparation

Before connecting the router to WHMCS, make sure that:

  • MikroTik RouterOS 7.20 or later is installed.
  • A WireGuard interface has been created on the router.
  • The RouterOS REST API is available.
  • The API user has permissions sufficient to manage WireGuard peers, addresses, queues, and traffic data required by the module.
  • The selected HTTP or HTTPS service and port are accessible from the WHMCS server.
  • When a secure connection is used, HTTPS and a valid router certificate are configured correctly.

Important: Restrict API access to trusted IP addresses whenever possible and use HTTPS for production environments.

Server Configuration

4. Navigate to System SettingsServers and click Add New Server.

Choose MikroTik WireGuard VPN from the Module dropdown menu and provide the router connection details.

MTWG 4.png

Configure the following fields:

  • Name – enter a descriptive server name.
  • Hostname – provide the router hostname or IP address.
  • Username – enter the RouterOS API username.
  • Password – enter the password assigned to the API user.
  • Port – provide the port used by the RouterOS REST API.
  • Secure – enable to connect through HTTPS.
  • IP Address Pool – define the tunnel IP address range used to assign addresses to new VPN peers.
5. Use Test Connection to verify the provided credentials and connection settings.

If the test is successful, save the server configuration.

File:MTWG 5.png
6. Create or select a server group and assign the configured MikroTik server to it.

The server group can later be selected in the product's module settings. Multiple routers may be added to support a larger VPN infrastructure.

MTWG 6.png

Product Configuration

7. Navigate to System SettingsProducts/Services and create a new product or edit an existing one.

Open the Module Settings tab and select MikroTik WireGuard VPN as the module.

MTWG 7.png
8. Configure the VPN service parameters.
MTWG 8.png

The available settings include:

  • Server Group – select the group containing the MikroTik router that will host the VPN peer.
  • WireGuard Interface – select or enter the WireGuard interface used for the service.
  • Comment Prefix – define the prefix added to comments identifying module-created peers.
  • Allowed IPs – specify the addresses or networks routed through the VPN tunnel.
  • DNS Servers – define the DNS servers included in the client configuration.
  • Persistent Keepalive – set the keepalive interval in seconds.
  • Upload Speed Limit – define the maximum upload speed assigned to the service.
  • Download Speed Limit – define the maximum download speed assigned to the service.
  • Traffic Statistics – enable traffic data collection and presentation.
  • Traffic Data Retention Period – define how long collected traffic records should be stored.
  • Setup Guide URL – provide a link to your VPN setup instructions.
  • WireGuard Client Download URL – provide a link clients can use to download the WireGuard application.
  • Usage-Based Metric Billing – enable reporting of download and upload usage to WHMCS metric billing.

Note: The tunnel IP address pool is configured in the MikroTik server settings rather than separately for each product.

9. Select the preferred provisioning method and save the product settings.

Depending on the selected WHMCS option, the VPN account may be created automatically after the first payment, immediately after order placement, or manually by an administrator.

File:MTWG 9.png

Management

Addon Module

The addon module provides a centralized overview of MikroTik servers, WireGuard accounts, traffic, and module activity.
Navigate to AddonsMikroTik WireGuard VPN to open it.

Dashboard

The Dashboard presents the most important information about the module configuration and provisioned services.

Use the summary widgets to review servers, VPN accounts, and WHMCS services. The traffic overview graph presents the general amount of data transferred during the selected period.

MTWG 12.png

Servers

The Servers page lists MikroTik routers configured in WHMCS.

For each entry, you can review its name, hostname, connection port, secure connection status, assigned services, and current availability.

MTWG 13.png

Note: Router connection settings are managed in WHMCS System SettingsServers. The addon page provides a centralized overview of the configured servers.

Accounts

The Accounts page contains WireGuard VPN accounts and peers provisioned through WHMCS.

Use search and filters to locate a specific account or narrow the list by server and current state.

MTWG 14.png

The list may include:

  • related WHMCS service and client
  • assigned MikroTik server
  • WireGuard interface
  • peer state
  • last handshake
  • uploaded and downloaded traffic
Open an account to review its peer details, assigned tunnel address, connection information, and WireGuard configuration.
MTWG 15.png

Logs

The Logs section records module activity and errors.

Use it to review performed actions and diagnose provisioning or communication problems. Search and filtering options help locate relevant entries.

MTWG 16.png

Translations

The Translations tool allows you to customize the module language files directly from the addon module.

Select a language, locate the required phrase, provide its custom translation, and save the changes.

MTWG 17.png

Tip: Custom translations created with this tool are preserved separately from the original language files, making them easier to maintain during module updates.

Access Control List

Use the Access Control List to define which addon module sections and actions are available to individual WHMCS administrator roles.

Grant only the permissions required by each staff group and save the configuration.

MTWG 18.png

Admin Area

Open a client's product or service in the WHMCS admin area to manage the related WireGuard VPN account.

The service view displays the current account state, MikroTik server, WireGuard interface, tunnel address, bandwidth limits, and connection details.

Administrators can also perform the standard module commands:

  • Create
  • Suspend
  • Unsuspend
  • Terminate
  • Change Package
MTWG 19.png
Use the available management actions to preview the WireGuard configuration, download the .conf file, reset the VPN connection, and review traffic statistics.
MTWG 20.png

Traffic Statistics

The traffic statistics view presents uploaded and downloaded data for the selected service.

Switch between daily and monthly views to analyze usage over the required period.

File:MTWG 21.png

VPN Configuration

The configuration view contains the connection parameters required by the WireGuard client.

Administrators can preview the generated configuration or download it as a ready-to-use .conf file.

MTWG 22.png

Client Area

The client area gives customers direct access to their WireGuard VPN service and the resources required to configure a connection.

VPN Dashboard

The main service page displays the VPN account and connection status, assigned tunnel IP address, WireGuard interface, endpoint information, and applied upload and download limits.

Depending on the product configuration, clients can also open the setup guide and download the WireGuard application.

MTWG 23.png

Available client actions include:

  • previewing the WireGuard configuration
  • scanning the configuration QR code
  • downloading the ready-to-use .conf file
  • resetting the VPN connection
  • opening the setup guide
  • downloading the WireGuard client

Configuration And QR Code

Clients can preview the complete WireGuard configuration and scan the generated QR code to quickly configure the connection on a compatible device.

The same configuration can be downloaded as a .conf file.

MTWG 24.png

Important: The WireGuard configuration contains sensitive connection data. Clients should store it securely and should not share it with unauthorized persons.

Traffic Statistics

The Traffic Statistics section allows clients to review the amount of uploaded and downloaded data.

Statistics can be displayed in daily or monthly intervals.

MTWG 25.png

Reset VPN Connection

Use Reset VPN Connection to refresh the WireGuard connection when required.

The client must confirm the action before it is performed.

MTWG 26.png

Cron Jobs

The module requires the WHMCS cron to run correctly for automated service operations, traffic collection, metric usage reporting, and data maintenance.
Make sure that the main WHMCS automation cron is configured according to the official WHMCS documentation.

Important: The exact execution schedule and any additional module cron commands should be copied from the module interface or confirmed in the release package before publication of this section.

Tips

1. Use HTTPS and restrict RouterOS API access to the IP address of your WHMCS server.
2. Configure separate MikroTik server groups when you want to distribute products between different routers or locations.
3. Make sure the tunnel IP address pools assigned to different routers do not overlap unless your network design explicitly requires it.
4. Enable traffic statistics only when the related RouterOS permissions and the WHMCS cron are configured correctly.
5. Configure both module metric reporting and WHMCS metric pricing before offering usage-based billing to clients.

Update Instructions

An essential guidance through the module update process can be found here.

Important: Before updating the module, create a backup of the WHMCS files and database. Review the module changelog for version-specific requirements and migration notes.

Common Problems

1. The connection test fails.
  • Verify the router hostname or IP address and REST API port.
  • Make sure the selected HTTP or HTTPS service is enabled and reachable from the WHMCS server.
  • Confirm the API username, password, and assigned RouterOS permissions.
  • If Secure is enabled, verify the router certificate and HTTPS configuration.
2. A VPN peer cannot be created.
  • Make sure the selected WireGuard interface exists on the target router.
  • Check whether the configured tunnel IP address pool contains an available address.
  • Review the module logs for the exact RouterOS API response.
  • Verify that the API user can manage the resources required by the module.
3. Traffic statistics are not displayed.
  • Confirm that traffic statistics are enabled in the product's module settings.
  • Make sure the WHMCS cron is running correctly.
  • Allow the module enough time to collect the first traffic records.
  • Review the module logs for traffic collection errors.
4. Usage-based charges are not generated.
  • Enable usage-based metric billing in the product's module settings.
  • Configure pricing for the Download (GB) and Upload (GB) metrics in WHMCS.
  • Confirm that traffic usage is being collected and reported.
  • Verify that the WHMCS automation cron is running.
Navigation
WHMCS Modules
WHMCS Module Bundles
WHMCS Widgets
Tools And Applications
Translations
General
FAQ
Community