dynamic location based advertisement on hotspot pagemum.mikrotik.com/presentations/vn15/iwan.pdf ·...
TRANSCRIPT
![Page 1: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/1.jpg)
Dynamic Location Based Advertisement on Hotspot PageHTTP://WWW.BELAJARMIKROTIK.COM
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 1
![Page 2: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/2.jpg)
About MeMy name is Iwan Chandra / BelajarMikroTik.COM - Indonesia
My activities:Assistant Trainer at BelajarMikroTik.COM since 2013MikroTik Academy Trainer for Sekolah Tinggi Teknik SurabayaAsistant Lecture at Sekolah Tinggi Teknik Surabaya IT Staff at Sekolah Tinggi Teknik SurabayaMikroTik Certified Trainer (probably after 14.00 today)
MikroTik CertificationMTCNA, MTCRE, MTCTCE, MTCWE, ACTR
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 2
![Page 3: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/3.jpg)
BelajarMikroTik.COMFocused on MikroTik Training and Certification (MTCNA, MTCRE, MTCINE, MTCWE, MTCTCE, and MTCUME)
Established in 2012 by a group of Independent MikroTik Certified Trainers (Herry Darmawanand Akbar Azwir)
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 3
![Page 4: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/4.jpg)
Trainerhttp://www.belajarmikrotik.com/trainer/
4/17/2015 IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN2015 4
![Page 5: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/5.jpg)
Background of This TopicHotSpot used to provide and controlling Internet Access to users
HotSpot page offer page customization
HotSpot customization can be used for advertisement
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 5
![Page 6: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/6.jpg)
The Problem,…HotSpot page is usually display static page
And the advertisement can be same in all over hotspot area in a local area network
Trust me! You don’t want Burger King’s Ads in a McDonalds’s Restaurants,…
Unless you want it to be shown on purpose
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 6
![Page 7: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/7.jpg)
Objectives
Show different login page on different HotSpot Area with one controlled HotSpot
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 7
![Page 8: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/8.jpg)
Tools and TechniquesIPv4 Subnetting
DHCP Server and Relay
MikroTik HotSpot
Network Address Translation
Web Server with php5
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 8
![Page 9: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/9.jpg)
HotSpot Server
Site “1”
Site “2”
Site “X”
WAN
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 9
![Page 10: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/10.jpg)
IP version 4Use widely as universal logical addressing
Consist of 32 bit of binary number
Each 8 bit, represented with a decimal number
10.14.32.172
0000 1010 0000 1110 0010 0000 1010 1100
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 10
![Page 11: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/11.jpg)
SubnetingWith IP Address and Subnet Mask, we can get:Network ID
Broadcast Address
Hosts
Example for address 10.15.17.32/8:Network ID: 10.0.0.0
Broadcast Address: 10.255.255.255
Hosts: 10.0.0.1-10.255.255.254 (16,777,214 host)
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 11
![Page 12: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/12.jpg)
Subneting
IP Addess 10.14.32.172 Subnet Mask 255.0.0.0
0000 1010 . 0000 1110 . 0010 0000 . 1010 1100
1111 1111 . 0000 0000 . 0000 0000 . 0000 0000
AND
0000 1010 . 0000 0000 . 0000 0000 . 0000 0000
A BA^B
0 0 0
0 1 0
1 0 0
1 1 1
10 0 0 0Network ID
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 12
![Page 13: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/13.jpg)
Allocate The SubnetDivide the base network into subnets with smaller range
10.0.0.0/8Hosts: 10.0.0.1-10.255.255.254
10.0.1.0/24Hosts:10.0.1.1-10.0.1.254
10.0.2.0/24Hosts:10.0.2.1-10.0.2.254
10.0.3.0/24Hosts:10.0.3.1-10.0.3.254
10.0.4.0/24Hosts:10.0.4.1-10.0.4.254
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 13
![Page 14: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/14.jpg)
HotSpot Server
Site “1”
Site “2”
Site “X”
WAN
10.0.0.254/8
10.0.0.3/8
10.0.0.2/8
10.0.0.1/8
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 14
![Page 15: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/15.jpg)
HotSpot Server
Site “1”
Site “2”
Site “X”
WAN
WLAN:10.0.1.1/24
WLAN:10.0.2.1/24
WLAN:10.0.3.1/24
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 15
![Page 16: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/16.jpg)
Then How We Distribute The Subnets?
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 16
![Page 17: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/17.jpg)
DHCP ServerThe Dynamic Host Configuration Protocol is used for dynamic distribution of network setting such as:IP address and netmask
Default gateway address
DNS and NTP server addresses
There can be only one DHCP server per interface/relay combination on the router
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 17
![Page 18: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/18.jpg)
DHCP RelayDHCP Relay is just a proxy that is able to receive a DHCP discovery and request and resend them to the DHCP server
There can be only one DHCP relay between DHCP server and DHCP client
DHCP communication with relay does not require IP address on the relay, but relay's “local address” option must be the same with server's “relay address” option
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 18
![Page 19: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/19.jpg)
10.0.0.254/8DHCP Server
DHCP Relay
10.0.0.1/8
10.0.1.1/24
DHCP ClientIWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 19
![Page 20: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/20.jpg)
DHCP AssignmentDHCP Relay will be use to distribute the smaller subnets to each allocated area
The DHCP allocation still will be administered by DHCP Server
DHCP Relay just facilitating the broadcast request between client and server
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 20
![Page 21: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/21.jpg)
DHCP Server
DHCP Relay “1”
DHCP Relay “2”
DHCP Relay “X”
WAN
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 21
![Page 22: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/22.jpg)
HotSpotCentral Router will be administer the DHCP allocation, and the hotspot
The Site Router will not used as HotSpotServer at all
By default, hotspot server will show “hotspot/login.html” page which loaded from it’s directory.
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 22
![Page 23: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/23.jpg)
HotSpot Result
Active HotSpot User will show different IP Address with IP Address from DHCP Server Lease
It’s normal, because HotSpot create different pool, aside from DHCP Server
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 23
![Page 24: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/24.jpg)
HotSpot PageThis page can be customized by editing the login.html file
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN2015
Source:http://wiki.mikrotik.com/wiki/HotSpot_external_login_page
4/17/2015 24
![Page 25: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/25.jpg)
Customize “login.html”The new “login.html” file will redirected to other server outside the router
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN2015
Source:http://wiki.mikrotik.com/wiki/HotSpot_external_login_page
4/17/2015 25
![Page 26: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/26.jpg)
New HotSpot PageThe new page is still displaying the same page on each HotSpotSites
Because they refer to the same web server
We need to send the request, to the different server
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 26
![Page 27: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/27.jpg)
Network Address TranslationUsed to change IP Address
There is two type of NAT:SRC-NAT, change source IP Address
DST-NAT, change destination IP Address
We are using DST-NAT in this scenario
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 27
![Page 28: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/28.jpg)
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 28
![Page 29: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/29.jpg)
Set DST-NATCreate DST-NAT for destination address “192.168.8.126” on each area, by filtering the source Mac Address, to the desired server
Don’t forget to check your Area Connected Interface’s Mac Address
/ip firewall nat add chain=dstnat
dst-address=192.168.8.126
protocol=tcp dst-port=80
src-mac-address=<<area 1 router mac-address>>
action=dst-nat to-addresses=192.168.8.131
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 29
![Page 30: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/30.jpg)
Set DST-NAT
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 30
![Page 31: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/31.jpg)
Web Server with PHP5Webserver will catch the parameters which posted from the login.html using phpvariables, and then pass the input, back to the router
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 31
![Page 32: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/32.jpg)
WAN
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 32
![Page 33: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/33.jpg)
SummaryUse the subnet segmentation to differentiate the area
DHCP Relay used to distribute the smaller subnet from main subnet
Manipulate hotspot page dynamically by redirect the hotspot request to external web server
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 33
![Page 34: Dynamic Location Based Advertisement on Hotspot Pagemum.mikrotik.com/presentations/VN15/iwan.pdf · Dynamic Location Based Advertisement on Hotspot Page HTTP:// 4/17/2015 IWAN CHANDRA](https://reader031.vdocument.in/reader031/viewer/2022030709/5af6ef677f8b9a5b1e8fc36e/html5/thumbnails/34.jpg)
Q & AIWAN CHANDRA
FOR MIKROTIK USER MEETING - VIETNAM, HANOI 2015
IWAN CHANDRA | BELAJARMIKROTIK.COM INDONESIA FOR MUM-VN20154/17/2015 34