This guide shows how to configure a Mikrotik router in order to make its Hostpot service to use Amplespot as external login (splash page) provider.

Please note:

  • This guide assumes that you have experience working with Mikrotik and does not replace the original Mikrotik documentation.
  • Your controller must be running the latest stable release of RouterOS (6.41 at the time of writing of this article)

Prerequisites

This article applies to all Mikrotik routers. The configuration procedure has been performed and tested on a number of RB boards, including:

  • RB941 series
  • RB750 series
  • RB2011iL-IN
  • RB2011iL series
  • RB2011UiAS series
  • RB1100AH series
  • CCR1016 series
  • CCR1036 series
  • RB1000 series
  • RB1100 series
  • RB951
  • RBcAPL
  • RB962UiGS

To integrate Mikrotik router with the Amplespot, it is necessary that the router is able to: 

  • reach internet via the ports: TCP/80, TCP/443, UDP/1812, UDP/1813
  • be configured to correctly assign IP addresses to the clients

If you would like to use the secure version of Amplespot Captive Portal (over https) - make sure you have correct SSL certificate installed on your router.

It is also necessary to get the Winbox client (it is recommended to get the last version of the tool at http://www.mikrotik.com/download).

1. Login to your router

The access to the device is performed by using WinBox.

Launch WinBox app. Wait a while to get MAC Addresses list. Make note of that MAC address, we will need it for the Hotspot setup in Section 3.

Select requested address (not IP if you are in a different network). 

2. Configure RADIUS server

Add primary radius server. Go to Radius in the left-hand menu and create new RADIUS server and open the General tab:

Service: hotspot
Caller ID: -leave blank-
Secret: -see doc-
Authentication Port: 1812
Accounting Port: Enabled
Timeout: 2000 ms

Doc: http://docs.amplespot.com/hardware-integrations/amplespot-captive-portal-and-radius-settings

Repeat this step to create secondary RADIUS server.

3. Create Hotspot profile

Go to IP in the left-hand menu and then open Hotspot

Click Hotspot Setup button to create new hotspot server.

Select the Interface where you want the hostspot to run. This can be a wireless, bridge or ethernet interface depending on your network architecture.

Complete rest of the steps to create the hostspot server. The settings will depend on your network architecture. Refer to Mikrotik hotspot documentation for additional info.

Default/Recommended settings:

HotSpot Interface: wlan1
Local Address of Network: -leave defaults-
Address Pool of Network: -leave defaults-
Hotspot Certificate: none
IP address of SMTP server: 0.0.0.0
DNS servers: 8.8.8.8 and 8.8.4.4 (or any other DNS of your choice)
DNS name: amplespot.local

Double-click on the name of hotspot service you just created and change following settings:

Name:
Change this to the dash-delimited MAC address of the Ethernet interface your router (as noted in section 1) followed by semicolon, followed by the name of the guest SSID you will use with this hotspot service. 

For example for mac address 64:D2:54:52:12:AD and SSID name Guest-WiFi change name of the hotspot server to: 

64-D1-54-56-14-DD:Guest-WiFi

If you are connecting to your router via IP address, you can get the MAC address by going to Interfaces in the left-hand menu and then opening Ethernet interface that you are using to connect to the Internet.

Addresses per MAC:
Make sure you change this to 1

Click OK to save changes

Click on Server Profiles tab, open the Profile you are using in your hotspot server configuration (previous step) and select Login tab. Make following changes:

Login by: 

    MAC
    HTTP CHAP
    HTTP PAP

MAC Auth. Mode: MAC as username and password

Select the RADIUS tab and make following changes:

Use RADIUS: -ticked-
MAC Format: XX-XX-XX-XX-XX-XX
Accounting: ticked
Interim Update: 00:05:00
NAS Port Type: 19 (wireless-802.11

Open the General tab and take note of the HTML Directory location

Click OK to save changes

Select the Users tab and create new user

Server: all (or name of the server you created in previous steps)
Name: User
Password: -leave blank-
Profile: default (or choose specific profile)

Click OK to save changes

Select the User Profiles tab and edit default user profile. 

(You can also create new profile and link it to the hotspot Server that you created earlier.)

Address Pool: -the address pool name in hotspot server config-
Shared Users: -leave blank-
Add MAC Cookie: unticked
Open Status Page: HTTP login
Transparent Proxy: unticked

Click OK to save changes

4. Create Walled Garden configuration

The Walled Garden needs to be created in order that the end-clients (wifi users alike) can access online resources required in order to load Splash Pages hosted by Amplespot as well as other external resources required for social media network authentication. Review this Mikrotik documentation article for more information.

We will create the Walled Garden with the script. 

Go to System in the left-hand menu and select Scripts. Create new script and give it a name WalledGarden. Paste following code into the Source window:

/ip hotspot walled-garden
add dst-host=cp.amplespot.com
add dst-host=wifi.amplespot.com
add dst-host=static.amplespot.com
add dst-host=www.google-analytics.com
add dst-host=www.googletagmanager.com
add dst-host=api.mailgun.net
add dst-host=ipinfo.io

/ip hotspot walled-garden ip
add dst-host=cp.amplespot.com
add dst-host=wifi.amplespot.com
add dst-host=static.amplespot.com
add dst-host=www.google-analytics.com
add dst-host=www.googletagmanager.com
add dst-host=api.mailgun.net
add dst-host=ipinfo.io

You may need to add more domains depending on sign-up options you would like to use in Amplespot Captive Portal - find up to date list of  Walled Gardens here.

Click Apply and Run the script. 

You can now find Walled Garden created in Hotspot settings. Walled Garden entries can also be added manually manually via Hotspot menu.

5. Edit hotspot login page

We will now edit the hotspot login page so it will forward end-users to Amplespot service (splash pages).

Go to System in the left-hand menu and select Scripts. Create new script and give it a name ReplaceLogin. Paste following code into the Source window:

local mac [system routerboard get serial-number];
:if (  [system routerboard get routerboard] = yes ) do { :set mac [interface ethernet get ether1 mac-address]};
 
/file set "flash/hotspot/login.html" contents="<html>
<head>
<meta http-equiv=\"refresh\" content=\"0; url=http://cp.amplespot.com/mktk/?rad=yes&apmac=$mac&ssid=\$(server-name)&client_mac=\$(mac)&client_ip=\$(ip)&userurl=\$(link-orig)&login_url=\$(link-login-only)\" />
<meta http-equiv=\"pragma\" content=\"no-cache\">
<meta http-equiv=\"expires\" content=\"-1\">
</head>
</html>"

Take note of the following (highlighted with yellow mark below:

flash/hotspot
this shall match to HTML Directory specified in Hotspot Server Profile

url=http://cp.amplespot.com
you may user https instead of http if you have valid certificate in your hostspot.

Click Apply and Run the script. 

5. Add router to Amplespot Admin Portal

Now head to Amplespot Admin Portal, click on Access Points in the left-hand menu and then on Add new Unmanaged Access Point

Select the Access Point's make and model, type in MAC Address (from step 3 of this manual) and Name, Select the Country and the Captive Portal Zone where you would like to add this Access Point. You will be able to move your access point to other Zones later.

!! IMPORTANT!! Make sure that the name of the SSID used by the Captive Portal Zone you are selecting exactly corresponds to the name of the SSID on the Mikrotik router.

Click Add Access Point. You are done!

Did this answer your question?