Mikrotik Hotspot Captive Portal Configuration

Mikroitk Hotspot Captive Portal

Hi Friends, Today we will configure Mikrotik Hotspot and CAPTIVE Portal with no Username and Password. User can just click to "Click HERE" for accessing Internet services after Click to specific area user will be redirect to specific URL. We will setup our Mikrotik as a Hotspot Server then edit login & alogin files place in files hotspot folder in Mikrotik directory.

Scenario:

We can use this Mikrotik Hotspot Captive Portal scenario in University , Cafeteria , Coffee Shops, Salons, where we want to entertain our clients but also want to show our portfolio or website as well.
We can redirect users to a specific web URL after login.

Hardware for this project:

 We will use Mikrotik Routerboard for Hotspot configuration and GrandStream or Unifi for Wireless Access point for Captive Portal.

Wireless Configuration:

We will config GrandStream 7660 as a AP "Access Point" and do not set the password.

Mikrotik Configuration using Winbox:

We will setup Mikrotk as a Hotspot Server for Captive Portal.
Lets start the setting,

We will use Port 1 as a WAN and Port 3 as LAN.

you can just copy & paste whole bellow command and paste in terminal of Mikrotik your all setting will be done.
or you can see in video how to setup by your hand.


#ether1 use as a WAN having DHCP services on it.
#If you have static ip then add in IP Address
/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface=ether1 use-peer-dns=no

#LAN IP
/ip address
add address=192.2.2.1/24 interface=ether3 network=192.2.2.0

#DNS
/ip dns
set servers=8.8.8.8,8.8.4.4

#NAT
/ip firewall nat
add action=masquerade chain=srcnat comment="masquerade

#IP Pool
/ip pool
add name=dhcp_pool1 ranges=192.2.2.2-192.2.2.254

#DHCP Server
/ip dhcp-server
add address-pool=dhcp_pool1 disabled=no interface=ether3 name=dhcp1
/ip dhcp-server network
add address=192.2.2.0/24 gateway=192.2.2.1

#Hotspot Setting
/ip hotspot profile
add dns-name=login.hotspot.net hotspot-address=192.2.2.1 login-by=\
    http-pap,trial name=hsprof1 trial-uptime-reset=30m1s
/ip hotspot add name=hotspot1 interface=ether3 address-pool=\
dhcp_pool1 profile=hsprof1 addresses-per-mac=1 disabled=no 

Now we will edit Hotspot page for redirect the user after login.
We will open Winbox , Click to file then drag and drop 2 html files (login & alogin) from winbox to my laptop then we will edit these files.
We use Notepad++ for editing the files you can open these files in simple notepad.
1st we will edit login.html file. just open the file in notepad++ and remove all the content and paste the bellow content and save it as login.html

<html>
<head>
<meta http-equiv="refresh" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
<body>
<table width="100%" style="margin-top: 10%;">
<tr>
<td align="center" valign="middle">
<div class="notice" style="color: #c1c1c1; font-size: 9px">
Please log on to use the internet hotspot service<br />$(if trial == 'yes')
<Font size="6">Use Internet Services, 
<a style="color: #FF8080
"href="$(link-login-only)?dst=$(link-orig-esc)&amp;username=T-$(mac-esc)">
<br><Font size="8">click here</a>.$(endif)</div><br />
		
</body>
</html>

Now we will edit alogin.html file. open this file in notepad or Notepad++ and remove all the content and paste the bellow content in it. 
You can change the URL
<html>
<head>
<meta http-equiv="refresh" content="0; url=https://www.youtube.com/c/iTInfoPK" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
</head>
</html>
We will Drag & Drop these edited html files in Mikrotik.
Now we can check the Mikrotik Hotspot Captive Portal redirection. When we connect to the Hotspot login page appears and we will just click to the "Click Here" and page will be automatically redirect to our desire URL.
Hope you like my effort.
Why not a Cup of COFFEE if you like my effort?

Post a Comment

0 Comments

About