The following guide is intended for advanced operators, understanding Mikrotik routers is required or you may break your current/working configuration! Also please note that all network traffic usage (accounting) will be registered for the same NASId in Control Center (that is the first location, registered on the "Identity" of the Mikrotik device) – even those ones which happened/actioned on the second location.
In this example we configure both hotspots to a bridge called "HS-bridge", and the second one will rest at VLAN10. (VLAN will be created by script as well).
- We start with creating the VLAN. Go to Winbox / Interfaces. Click on new (+) icon and set the ID for 10 and the interface to ether 3.
- Create your first location in Control Center and set the router up following our Mikrotik Gateway Install Guide and verify if it works.
- Create your second location in Control Center and change the "Internal Login" and "Logout URL’s" at Modify Hotspot Data / Splash page settings to "Custom" and with the following values: http://10.5.64.1/login and http://10.5.64.1/logout respectively
- Find the folder called "hotspot" on the Mikrotik router's directory and copy it to your computer. Edit the login.html and alogin.html files: change the value=”$(identity)” to value=OPERATORUSERNAME_LOCATIONIDNUMBER of the second location. (so if your operatorname is "hotspot" and this is the 3rd in Control center , it will be value="hotspot_3".
- Save, then rename the hotspot folder on your computer to hotspot2, and copy the whole hotspot2 folder to the root of your Mikrotik or to the /flash/ folder if it’s present in your device.
- Copy the following commands to a simple text editor and change the parameters to yours – in the first row depending on if you don’t have a flash folder on your Mikrotik you need to modify it to directory=/hotspot2. In the last row the OPERATORUSERNAME_LOCATIONIDNUMBER must be the set for the second location (hotspot_3 as of our example):
/ip hotspot profile add hotspot-address=10.5.64.1 name=hsprof2 html-directory=/flash/hotspot2
/ip pool add name=hs-pool-4 ranges=10.5.64.2-10.5.79.254
/interface vlan add name=vlan-10 vlan-id=10 interface=HS_bridge disabled=no
/ip dhcp-server add address-pool=hs-pool-4 disabled=no interface=vlan-10 lease-time=1h name=dhcp2
/ip hotspot add address-pool=hs-pool-4 disabled=no interface=vlan-10 name=hotspot2 profile=hsprof2
/ip address add address=10.5.64.1/20 comment="HotspotSystem network 2" interface=vlan-10 network=10.5.64.0
/ip dhcp-server network add address=10.5.64.0/20 comment="hotspot network 2" gateway=10.5.64.1
/ip firewall nat add action=masquerade chain=srcnat comment="masquerade hotspot network 2" src-address=10.5.64.0/20
/ip hotspot profile set hsprof2 use-radius=yes
/ip hotspot profile set hsprof2 login-by=http-pap,http-chap,https
/system scheduler add interval=1h name=up2 on-event="/tool fetch keep-result=no mode=http address=tech.hotspotsystem.com host=tech.hotspotsystem.com src-path=(\"up.php\\\?mac=\".[/interface ethernet get 0 mac-address].\"&nasid=\"OPERATORUSERNAME_LOCATIONIDNUMBER"&os_date=Mikrotik&uptime=\".[/system clock get time].\"%20up%20\".[/system resource get uptime].\",%20load%20average:%20\".[/system resource get cpu-load].\"%\")" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive start-date=jan/01/1970 start-time=01:00:00
And that’s it! If you check VLAN 10, you will see your second hotspot network, if you switch to your untagged network, it will be the first one.