1. Pengenalan MikroTik Hotspot
MikroTik Hotspot adalah fitur pada RouterOS yang memungkinkan Anda membuat captive portal — halaman login yang muncul sebelum pengguna bisa mengakses internet. Hotspot sangat populer di Indonesia untuk warnet, café, hotel, bandara, dan RT/RW net.
via WiFi
Captive Portal
setelah login
1.1 Komponen Hotspot
- Hotspot Server: Mengatur interface hotspot dan metode autentikasi
- Hotspot Profile: Menentukan konfigurasi login, timeout, dan rate limit
- Hotspot User: Daftar pengguna yang bisa login
- Hotspot User Profile: Template hak akses untuk user
- Walled Garden: Daftar situs yang bisa diakses tanpa login
- IP Binding: Aturan khusus untuk MAC address tertentu
2. Setup Hotspot Dasar
2.1 Prasyarat
- MikroTik Router dengan RouterOS minimal v6.43+
- Interface WiFi atau Ethernet yang akan dijadikan hotspot
- Koneksi internet yang sudah berjalan
- IP address untuk gateway hotspot (misal: 192.168.10.1/24)
2.2 Setup via Wizard (Quick Setup)
# Jalankan wizard hotspot /ip hotspot setup # Ikuti pertanyaan wizard: # Hotspot Interface: wlan1 (atau ether2) # Local Address of Network: 192.168.10.0/24 # Masquerade Network: yes # Address Pool: 192.168.10.2-192.168.10.254 # Select Certificate: none (bisa ditambah nanti) # SMTP Server: 0.0.0.0 # DNS Servers: 8.8.8.8, 8.8.4.4 # DNS Name: hotspot.local # Create Local Hotspot User: admin # Hotspot User Password: admin123
2.3 Setup Manual
# 1. Buat IP Address untuk interface hotspot /ip address add address=192.168.10.1/24 interface=wlan1 # 2. Buat DHCP Server (opsional, atau gunakan pool hotspot) /ip pool add name=hotspot-pool ranges=192.168.10.2-192.168.10.254 /ip dhcp-server add name=hotspot-dhcp interface=wlan1 \ address-pool=hotspot-pool lease-time=1h /ip dhcp-server network add address=192.168.10.0/24 \ gateway=192.168.10.1 dns-server=192.168.10.1 # 3. Buat DNS (agar captive portal bekerja) /ip dns set allow-remote-requests=yes servers=8.8.8.8,8.8.4.4 # 4. Buat Hotspot Profile /ip hotspot profile add \ name=hsprof1 \ hotspot-address=192.168.10.1 \ dns-name=hotspot.local \ html-directory=hotspot \ login-by=http-chap,http-pap \ use-radius=no # 5. Buat Hotspot Server /ip hotspot add \ name=hotspot1 \ interface=wlan1 \ address-pool=hotspot-pool \ profile=hsprof1 \ addresses-per-mac=1 # 6. Buat user default /ip hotspot user add name=admin password=admin123 # 7. Masquerade untuk NAT /ip firewall nat add chain=srcnat out-interface=ether1 \ action=masquerade
Gunakan wizard untuk setup awal karena lebih mudah dan otomatis membuat semua rule yang diperlukan. Setelah wizard selesai, Anda bisa menyesuaikan konfigurasi manual sesuai kebutuhan.
3. Walled Garden Configuration
Walled Garden adalah daftar situs atau layanan yang bisa diakses oleh user tanpa perlu login terlebih dahulu. Ini penting untuk mengizinkan akses ke situs tertentu seperti halaman promosi, WhatsApp, atau halaman registrasi.
3.1 Menambah Walled Garden berdasarkan Domain
# Izinkan akses ke WhatsApp tanpa login /ip hotspot walled-garden add dst-host=*.whatsapp.net /ip hotspot walled-garden add dst-host=*.whatsapp.com /ip hotspot walled-garden add dst-host=*.fbcdn.net # Izinkan akses ke Facebook (untuk login via FB) /ip hotspot walled-garden add dst-host=*.facebook.com /ip hotspot walled-garden add dst-host=*.facebook.net # Izinkan akses ke Google /ip hotspot walled-garden add dst-host=*.google.com /ip hotspot walled-garden add dst-host=*.googleapis.com /ip hotspot walled-garden add dst-host=*.gstatic.com # Izinkan akses ke halaman pembayaran/payment gateway /ip hotspot walled-garden add dst-host=*.midtrans.com /ip hotspot walled-garden add dst-host=*.xendit.co
3.2 Walled Garden berdasarkan IP dan Port
# Izinkan akses ke server tertentu berdasarkan IP /ip hotspot walled-garden ip add \ dst-address=31.13.64.0/18 \ dst-port=443 \ protocol=tcp \ action=accept # Izinkan DNS queries /ip hotspot walled-garden ip add \ dst-port=53 \ protocol=udp \ action=accept # Izinkan akses ke server update Windows /ip hotspot walled-garden ip add \ dst-address=13.107.4.50 \ dst-port=443 \ protocol=tcp \ action=accept
3.3 Walled Garden untuk Halaman Login Custom
# Izinkan akses ke CDN untuk asset login page /ip hotspot walled-garden add dst-host=*.cloudflare.com /ip hotspot walled-garden add dst-host=*.jsdelivr.net /ip hotspot walled-garden add dst-host=*.googleapis.com /ip hotspot walled-garden add dst-host=*.gstatic.com # Izinkan akses ke server gambar/logo Anda /ip hotspot walled-garden add dst-host=*.yourdomain.com
4. User Profile & Limitation
User Profile pada hotspot menentukan hak akses pengguna — kecepatan download/upload, durasi sesi, dan kuota data.
4.1 Membuat Hotspot User Profile
# Profile VIP - 10 Mbps unlimited /ip hotspot user profile add \ name=vip \ rate-limit=10M/10M \ shared-users=2 \ session-timeout=0s \ idle-timeout=5m \ keepalive-timeout=2m \ status-autorefresh=1m # Profile Reguler - 2 Mbps dengan kuota /ip hotspot user profile add \ name=reguler \ rate-limit=2M/1M \ shared-users=1 \ session-timeout=1d \ idle-timeout=5m \ keepalive-timeout=2m \ status-autorefresh=1m # Profile Trial - 512 Kbps terbatas /ip hotspot user profile add \ name=trial \ rate-limit=512k/256k \ shared-users=1 \ session-timeout=30m \ idle-timeout=3m \ keepalive-timeout=2m \ status-autorefresh=1m # Profile untuk warnet (1 jam) /ip hotspot user profile add \ name=warnet-1jam \ rate-limit=5M/5M \ shared-users=1 \ session-timeout=1h \ idle-timeout=5m \ keepalive-timeout=2m
4.2 Membuat User dengan Profile
# User dengan profile VIP
/ip hotspot user add \
name=john \
password=john123 \
profile=vip \
comment="VIP Customer"
# User dengan profile reguler
/ip hotspot user add \
name=guest01 \
password=guest01 \
profile=reguler \
comment="Regular Guest"
# Generate banyak user (voucher)
:for i from=1 to=50 do={
/ip hotspot user add \
name=("user" . $i) \
password=("pass" . $i) \
profile=reguler
}
# Lihat semua user
/ip hotspot user print
/ip hotspot user print where profile=vip
5. Custom Login Page
Halaman login default MikroTik sangat sederhana. Untuk profesional, Anda perlu membuat custom login page yang menarik dan sesuai branding.
5.1 Struktur File Hotspot
# Lokasi file hotspot di router: # /hotspot/ # File-file penting: # login.html - Halaman login utama # redirect.html - Halaman redirect setelah login # status.html - Halaman status user # logout.html - Halaman logout # error.html - Halaman error # alogin.html - Halaman login autentikasi # radvert.html - Halaman redirect advertisement # Download file untuk edit /fetch address=0.0.0.0 src-path=/hotspot/login.html \ dst-path=login.html mode=ftp upload=no # Upload file yang sudah diedit /fetch address=0.0.0.0 src-path=login.html \ dst-path=/hotspot/login.html mode=ftp upload=yes
5.2 Template Custom Login Page
<!DOCTYPE html>
<html>
<head>
<title>WiFi Hotspot Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Segoe UI', Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.login-card {
background: white;
border-radius: 16px;
padding: 40px;
width: 380px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
text-align: center;
}
.login-card h1 {
color: #333;
margin-bottom: 8px;
font-size: 24px;
}
.login-card p {
color: #666;
margin-bottom: 24px;
font-size: 14px;
}
.login-card input[type="text"],
.login-card input[type="password"] {
width: 100%;
padding: 12px 16px;
margin-bottom: 12px;
border: 2px solid #e0e0e0;
border-radius: 8px;
font-size: 16px;
transition: border-color 0.3s;
}
.login-card input:focus {
border-color: #667eea;
outline: none;
}
.login-card button {
width: 100%;
padding: 14px;
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
transition: transform 0.2s;
}
.login-card button:hover {
transform: translateY(-2px);
}
.error-msg {
color: #e74c3c;
margin-top: 10px;
font-size: 13px;
}
</style>
</head>
<body>
<div class="login-card">
<h1>📶 Welcome to WiFi</h1>
<p>Masukkan voucher atau akun Anda</p>
<form name="login" action="$(link-login-only)" method="post">
<input type="hidden" name="dst" value="$(link-orig)">
<input type="hidden" name="popup" value="true">
<input type="text" name="username" placeholder="Username / Voucher" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
$(if error)<div class="error-msg">$(error)</div>$(endif)
</div>
</body>
</html>
5.3 Variable Hotspot yang Tersedia
| Variable | Keterangan |
|---|---|
$(link-login) | URL halaman login |
$(link-login-only) | URL form login (action) |
$(link-orig) | URL tujuan asli user |
$(link-status) | URL halaman status |
$(link-logout) | URL logout |
$(error) | Pesan error jika login gagal |
$(username) | Username yang sedang login |
$(ip) | IP address client |
$(mac) | MAC address client |
| $(hostname) | Hostname client |
6. Bandwidth Management
MikroTik menyediakan beberapa cara untuk mengelola bandwidth pada hotspot — mulai dari rate limit sederhana hingga HTB (Hierarchical Token Bucket) yang advanced.
6.1 Rate Limit pada User Profile
# Format: rx-rate[/tx-rate] [rx-burst[/tx-burst]] # rx = download, tx = upload # Contoh: 2 Mbps download, 1 Mbps upload /ip hotspot user profile set [find name=reguler] \ rate-limit=2M/1M # Dengan burst: 2M normal, 4M burst /ip hotspot user profile set [find name=reguler] \ rate-limit=2M/1M 4M/2M # Contoh berbagai format: # 1M = 1 Mbps download, upload unlimited # 1M/512k = 1 Mbps download, 512 Kbps upload # 1M/512k 2M/1M = Dengan burst download 2M, upload 1M # 1M/512k 2M/1M 60/60 = Burst threshold 60 detik # 1M/512k 2M/1M 60/60 128k/64k = Dengan burst limit
6.2 Queue Tree untuk Hotspot
# Mark packet hotspot untuk queue tree /ip firewall mangle add chain=forward \ in-interface=wlan1 \ action=mark-packet \ new-packet-mark=hotspot-upload \ passthrough=no /ip firewall mangle add chain=forward \ out-interface=wlan1 \ action=mark-packet \ new-packet-mark=hotspot-download \ passthrough=no # Buat parent queue (total bandwidth) /queue tree add name=hotspot-total \ parent=global \ packet-mark=hotspot-download,hotspot-upload \ max-limit=100M # Child queue untuk download /queue tree add name=hs-download \ parent=hotspot-total \ packet-mark=hotspot-download \ max-limit=80M # Child queue untuk upload /queue tree add name=hs-upload \ parent=hotspot-total \ packet-mark=hotspot-upload \ max-limit=20M
7. Sistem Voucher
Sistem voucher adalah metode paling populer untuk monetisasi WiFi hotspot. Setiap voucher berisi username dan password yang valid untuk durasi tertentu.
7.1 Generate Voucher via Script
# Script untuk generate 100 voucher
:for i from=1 to=100 do={
:local user ("v" . [:pick [/system clock get date] 0 5] . $i)
:local pass ([:pick "ABCDEFGHJKLMNPQRSTUVWXYZ23456789" 0] . \
[:pick "ABCDEFGHJKLMNPQRSTUVWXYZ23456789" 1] . \
[:pick "ABCDEFGHJKLMNPQRSTUVWXYZ23456789" 2] . \
[:pick "ABCDEFGHJKLMNPQRSTUVWXYZ23456789" 3] . \
[:pick "ABCDEFGHJKLMNPQRSTUVWXYZ23456789" 4] . \
[:pick "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"5])
/ip hotspot user add \
name=$user \
password=$pass \
profile=reguler \
comment="Voucher 1 Jam"
}
7.2 Export Voucher untuk Cetak
# Export daftar voucher ke file
/ip hotspot user print file=vouchers.txt \
where comment~"Voucher"
# Format yang lebih rapi
:foreach user in=[/ip hotspot user find where comment~"Voucher"] do={
:local name [/ip hotspot user get $user name]
:local pass [/ip hotspot user get $user password]
:put ("Username: " . $name . " | Password: " . $pass)
}
Untuk pencetakan voucher yang lebih profesional, gunakan tool pihak ketiga seperti mkvoucher atau HotspotSystem yang bisa terintegrasi dengan MikroTik User Manager untuk generate dan cetak voucher otomatis.
8. MAC Address Login
MAC login memungkinkan perangkat tertentu terhubung ke internet tanpa perlu login manual — sangat berguna untuk perangkat IoT, printer, atau staff tetap.
8.1 MAC Address Bypass
# Izinkan MAC address tertentu tanpa login /ip hotspot ip-binding add \ mac-address=AA:BB:CC:DD:EE:FF \ type=bypassed \ comment="Printer Kantor" # Izinkan MAC address dengan IP tertentu /ip hotspot ip-binding add \ mac-address=11:22:33:44:55:66 \ address=192.168.10.100 \ type=bypassed \ comment="Server Lokal" # Block MAC address tertentu /ip hotspot ip-binding add \ mac-address=00:11:22:33:44:55 \ type=blocked \ comment="Device Terlarang" # Enable MAC login pada hotspot server /ip hotspot set [find] login-by=http-chap,http-pap,mac-cookie # MAC Cookie timeout /ip hotspot profile set [find] mac-cookie-timeout=1d
9. Monitoring & Logging
9.1 Monitoring User Aktif
# Lihat user yang sedang aktif /ip hotspot active print # Lihat detail user aktif /ip hotspot active print detail # Lihat user aktif dengan profile tertentu /ip hotspot active print where user=vip-user # Lihat statistik traffic user aktif /ip hotspot active print stats # Monitor bandwidth real-time /tool traffic-monitor interface=wlan1 # Lihat log hotspot /log print where topics~"hotspot"
9.2 Monitor User yang Terputus
# Lihat user yang sudah logout (hostspot host) /ip hotspot host print /ip hotspot host print where authorized=yes # Lihat semua user termasuk yang belum login /ip hotspot host print detail # Reset counter user /ip hotspot user reset-counters [find name=user01] # Cek kuota/usage user /ip hotspot user print stats
10. Troubleshooting
| Masalah | Penyebab | Solusi |
|---|---|---|
| Login page tidak muncul | DNS tidak berjalan | Pastikan DNS server aktif dan allow-remote-requests=yes |
| Redirect loop | NAT rule salah | Pastikan masquerade rule benar dan hotspot bypass ada |
| User bisa akses tanpa login | Walled garden terlalu luas | Cek dan kurangi aturan walled garden |
| Bandwidth limit tidak bekerja | Format rate-limit salah | Gunakan format rx/tx yang benar |
| Custom page error | Variable salah | Pastikan syntax $(variable) benar |
| User tidak bisa login | User disabled/habis | Cek status user dan profile limitation |
| HTTPS tidak redirect | Limitasi HTTPS captive portal | Gunakan DNS redirect atau certificate |
# Aktifkan debug logging /system logging add topics=hotspot action=memory # Lihat log hotspot /log print where topics~"hotspot" # Cek firewall rules hotspot /ip firewall filter print where comment~"hotspot" # Cek NAT rules /ip firewall nat print where comment~"hotspot" # Pastikan IP pool tidak habis /ip pool used print where name=hotspot-pool
Quiz Pemahaman
🧠 Tes Pemahaman: MikroTik Hotspot
Uji pemahaman Anda tentang materi di atas!
1. Apa fungsi dari Walled Garden pada MikroTik Hotspot?
2. Format rate-limit "2M/1M" pada MikroTik berarti?
3. Fitur apa yang memungkinkan perangkat terhubung tanpa login manual?
4. Mengapa custom login page penting untuk bisnis hotspot?
5. Apa yang harus dilakukan jika login page hotspot tidak muncul?