วันอาทิตย์ที่ 18 ตุลาคม พ.ศ. 2558

Mikrotik Hotspot Freeradius config file

- Port ether2 ip 192.168.1.2/24 ต่อกับ Gateway 192.168.1.1
- Port ether3 ip 10.0.1.1/24
- แจกไอพี 10.0.1.10 - 10.0.1.250
- DNS 192.168.1.1 , 8.8.8.8
- เรียกใช้ฐานข้อมูลผู้ใช้จาก Radius Server 192.168.1.1 secret = testing123

/ip hotspot profile
add hotspot-address=10.0.1.1 login-by=http-chap,http-pap name=hsprof1 \
    use-radius=yes
/ip pool
add name=hs-pool-3 ranges=10.0.1.10-10.0.1.250
/ip dhcp-server
add address-pool=hs-pool-3 disabled=no interface=ether3 lease-time=1h name=\
    dhcp1
/ip hotspot
add address-pool=hs-pool-3 disabled=no interface=ether3 name=hotspot1 \
    profile=hsprof1
/tool user-manager customer
set admin access=\
    own-routers,own-users,own-profiles,own-limits,config-payment-gw
/ip address
add address=192.168.1.2/24 comment=WAN interface=ether2 network=192.168.1.0
add address=10.0.1.1/24 comment=LAN interface=ether3 network=10.0.1.0
/ip dhcp-server network
add address=10.0.1.0/24 comment="hotspot network" gateway=10.0.1.1
/ip dns
set servers=192.168.1.1,8.8.8.8
/ip firewall filter
add action=passthrough chain=unused-hs-chain comment=\
    "place hotspot rules here" disabled=yes
/ip firewall nat
add action=passthrough chain=unused-hs-chain comment=\
    "place hotspot rules here" disabled=yes
add action=masquerade chain=srcnat comment="masquerade hotspot network" \
    src-address=10.0.1.0/24
/ip hotspot user
add name=admin
/ip route
add check-gateway=ping distance=1 gateway=192.168.1.1
/radius
add address=192.168.1.1 secret=testing123 service=hotspot timeout=2s
/radius incoming
set accept=yes
/system clock
set time-zone-name=Asia/Bangkok
/system lcd
set contrast=0 enabled=no port=parallel type=24x4
/system lcd page
set time disabled=yes display-time=5s
set resources disabled=yes display-time=5s
set uptime disabled=yes display-time=5s
set packets disabled=yes display-time=5s
set bits disabled=yes display-time=5s
set version disabled=yes display-time=5s
set identity disabled=yes display-time=5s
set ether1 disabled=yes display-time=5s
set ether2 disabled=yes display-time=5s
set ether3 disabled=yes display-time=5s
set ether4 disabled=yes display-time=5s
set ether5 disabled=yes display-time=5s
/tool user-manager database
set db-path=user-manager




วันศุกร์ที่ 16 ตุลาคม พ.ศ. 2558

Mikrotik Hotspot Freeradius

วิธี set Mikrotik เป็น Hotspot โดยใช้ฐานข้อมูลผู้ใช้จาก Freeradius Server
   โดยที่ Fix ip ของ Mikrotik เป็น 192.168.1.2 ต่อกับ Gateway ip 192.168.1.1
   Freeradius Server ip 192.168.1.1

- ใช้ port 1 เป็นขา gateway ตั้งค่า ip 192.168.1.2/24
   โดยกด IP เลือก Addresses กด + ใส่ Address: 192.168.1.2/24 , Interface:  ether1-gateway




- เพิ่ม Route เพื่อให้ออกเน็ตได้
   โดยกด IP เลือก Routes กด + ใส่ Dst. Address: 0.0.0.0/0 , Gateway: 192.168.1.1 ,
   Check Gateway: ping




- ตั้งค่า DNS
   โดยกด IP เลือก DNS ใส่ Server: 192.168.1.1




- ทดลอง ping ip, host ดูว่าออกเน็ตได้หรือเปล่า
   โดยกด New Terminal แล้วใช้คำสั่ง ping 8.8.8.8 , ping www.google.com




- ตั้งค่า Radius Server
   โดยกด Radius กด + ติ๊กที่ hotspot ใส่ Address: 192.168.1.1 , Secret: รหัสของ Freeradius ,                     Authentication Port: 1812 , Accounting Port: 1813 , Timeout: 300


   กด Incoming ติ๊กที่ Accept ใส่ Port: 3799


   กดแถบ Status ดูถ้ามีค่า Requests และ Accepts แสดงว่า Mikrotik ติดต่อกับ Radius Server ได้ 
   ถ้ามี Timeouts มากให้เพิ่มค่า Timeoute ในแถบ General

   


- ตั้งค่า Hotspot
   โดยกด IP เลือก Hotspot กดแถบ Server แล้วกด Hotspot Setup
   Hotspot Interface: ether2-master-local


   Local Address of Network: 192.168.88.1/24 ติ๊กที่ Masquerade Network


   Address Pool of Network: 192.168.88.10-192.168.88.254


   Select Certificate: none


   IP Address of SMTP Server : 0.0.0.0


   DNS Servers: 192.168.1.1 หรือ 8.8.8.8


   DNS Name: ไม่ต้องใส่


   Name of HotSpot User: admin , Password for the User: ไม่ต้องใส่


   กดแถบ Server Profiles แล้วกดเลือก profile ที่เพิ่มเข้ามาใหม่ (hsprof1)
   แถบ Login ติ๊กที่ HTTP CHAP กับ HTTP PAP
  

   แถบ RADIUS ติ๊กที่ Use RADIUS กับ Accounting , NAS Port Type: 19 (wireless-802.11)





- เสียบสายแลนของคอมพิวเตอร์กับ Mikrotik จะได้ ip 192.168.88.xxx ทดลองเปิดเวปจะเด้งเข้าหน้า        จอ login





เอกสารอ้างอิง
MikroTik's Remote Radius Configuration