راه اندازی hotspot در میکروتیک

صفحه اصلی کارگروهها >> میکروتیک  >> راه اندازی hotspot در میکروتیک
احسان پوررضایی

احسان پوررضایی

در کارگروه: میکروتیک
تعداد ارسالي: 50
13 سال پیش در تاریخ: دوشنبه, مهر 04, 1390 16:44

Mikrotik Hotspot Gateway


راهنمای راه اندازی سریع:
در راهنمای خود میکروتیک برای راه اندازی یک راهنمای سریع توضیح داده شده و سپس از روش پرسش و پاسخ برای توضیحات بیشتر کمک گرفته شده است.من نیز مشابه همین روش را در پیش خواهم گرفت.پس ابتدا راه اندازی سریع و سپس توضیح قسمت های مختلف.
توصیه می شود برای سادگی کار ازwinbox* استفاده کنید. بعضی توضیحات را با استفاده winbox و بعضی را با command* ارائه خواهم داد.
پکیج هایی که باید قبل از راه اندازی نصب شده باشند:
Packages required: hotspot, dhcp
سرویس هایی که باید قبل از راه اندازی Hotspot فعال کرده باشید :



  1. سرویس DNS با استفاده از کامند /ip dns

  2. سرویس DHCP

  3. سرویس connection tracking* (/ip firewall connection tracking set enabled=yes)


برای راه اندازی Hotspot به حداقل دو کارت شبکه نیاز دارید(interface) یکیPublic که به اینترنت متصل است و باید با RADUS سرور وDNS* سرور ارتباط داشته باشد دومی Local که کاربرهای Hotspot به آن متصل شوند.روی هر Interface امکان راه اندازی فقط یک Hotspot سرور وجود دارد.پس می توانید در آن واحد Hotspot های مختلفی داشته باشید روی Interface های جداگانه.لازم به توضیح است برای راه اندازی Hotspot بی سیم نیازی نیست حتما از کارت شبکه بی سیم استفاده شود می توانید یک کارت شبکه به سیستم وصل کنید و هر AP را مایلید به آن متصل کنید.نگران سازگاری نباشید.سازگاری فقط در مورد کارت های شبکه بی سیم متصل به MT (Mikrotik Router OS)مهم است.
برای فعال کردن Hotspot روی Interface Local* باید از یک Address Pool* مشابه با DHCPسرور راه اندازی شده استفاده کنید.


/ip hotspot add interface=local address-pool=dhcp-pool-1

در نهایت برای راه اندازی کافی است یک کاربر ایجاد کنید:


/ip hotspot user add name=admin

اکنون Hotspot راه اندازی شده است.
در سمت کلاینت باید تنظیمات TCP/IP*را انجام دهید.به صورت پیش فرض تنظیم روی اتوماتیک قرار دارد و همین برای گرفتن یک IP از MT کفایت می کند ولی توصیه می شود برای مدیریت بهتر در مورد پهنای باند از IP استاتیک استفاده کنید.یک IP*در رنج Interface Local به کارت شبکه کلاینت اختصاص دهید،DNS* وGateway* سرورMT* را بدهید.میتوانید با باز کردن مرورگر روی یک کامپیوتر که به Interface local*متصل شده است از این موضوع مطمئن شوید.باید صفحه خوشامدگویی Hotspot به نمایش درآید.
به صورت پیش فرض در هنگام اتصال کاربران یک رول مبتی بر NAT در قسمت ip firewall/Nat* به صورت داینامیک ایجاد می شود.در صورت ایجاد نشدن باید Interface Public را Nat* کنید.


ip firewall nat> add chain=srcnat action=masquerade out-interface=Public


مدیریت Hotspot
قسمت مدیریت را با استفاده از winbox* توضیح خواهم داد.
توضیحات ساده و یا بسیار فنی به زبان اصلی درج خواهد شد.
در نرم افزار winbox* از منوی IP قسمت Hotspot را انتخاب کنید.


 


برای مثال من در اینجا یک سرور Hotspot با نام wireless روی Interface wireless* و با address pool با مشخصه wireless* ایجاد کرده ام.
گزینه setup* یک ویزارد ساده برای راه اندازی سرور Hotspot ایجاد می کند.در صورتی که هنوز سرور را راه اندازی نکرده اید می توانید از این گزینه استفاده کنید.این گزینه تمام اطلاعات لازم برای راه اندازی را از شما سوال کرده و در نهایت سرور را راه اندازی خواهد کرد.


address pool of network (name) - IP address pool for the HotSpot network
dns name (text) - DNS domain name of the HotSpot gateway (will be statically configured on the local DNS proxy
dns servers (IP address,[IP address]) - DNS servers for HotSpot clients
hotspot interface (name) - interface to run HotSpot on
ip address of smtp server (IP address; default: 0.0.0.0) - IP address of the SMTP server to redirect SMTP requests (TCP port 25) to 0.0.0.0 - no redirect
local address of network (IP address; default: 10.5.50.1/24) - HotSpot gateway address for the interface
masquerade network (yes | no; default: yes) - whether to masquerade the HotSpot network
name of local hotspot user (text; default: admin) - username of one automatically created user
passphrase (text) - the passphrase of the certificate you are importing
password for the user (text) - password for the automatically created user
select certificate (name | none import-other-certificate) - choose SSL certificate from the list of the imported certificates
none - do not use SSL
import-other-certificate - setup the certificates not imported yet, and ask this question again


گزینه Profiles امکانی برای تنظیمات همزمان سرورهای مختلف ایجاد می کند.برای مثال شما چند پروفایل با تنظیمات مختلف ایجاد می کنید.سپس سرورهای مختلف Hotspot را به هر کدام که مایل باشد ارجاع می دهید و نیازی به تنظیم جداگانه هر سرور نخواهید داشت سوای آن بسیاری از تنظیمات کلیدی و اساسی Hotspot در همین جا انجام خواهد گرفت.
برای نمونه پروفایل default را بررسی می کنیم:


 


Submenu level: /ip hotspot profile

Property Description

dns-name (text) - DNS name of the HotSpot server. This is the DNS name used as the name of the HotSpot server (i.e., it appears as the location of the login page). This name will automatically be added as a static DNS entry in the DNS cache
hotspot-address (IP address; default: 0.0.0.0) - IP address for HotSpot service
html-directory (text; default: "") - name of the directory (accessible with FTP), which stores the HTML servlet pages (when changed, the default pages are automatically copied into specified directory if it does not exist already)
http-cookie-lifetime (time; default: 3d) - validity time of HTTP cookies
http-proxy (IP address; default: 0.0.0.0) - the address of the proxy server the HotSpot service will use as a proxy server for all those requests intercepted by Universal Proxy system and not defined in the /ip proxy direct list. If not specified, the address defined in parent-proxy parameter of /ip proxy. If that is absent too, the request will be resolved by the local proxy
login-by (multiple choice: cookie | http-chap | http-pap | https | mac | trial; default: cookie,http-chap) - which authentication methods to use
cookie - use HTTP cookies to authenticate, without asking user credentials. Other method will be used in case the client does not have cookie, or the stored username and password pair are not valid anymore since the last authentication. May only be used together with other HTTP authentication methods (HTTP-PAP, HTTP-CHAP or HTTPS), as in the other case there would be no way for the cookies to be generated in the first place
http-chap - use CHAP challenge-response method with MD5 hashing algorithm for hashing passwords. This way it is possible to avoid sending clear-text passwords over an insecure network. This is the default authentication method
http-pap - use plain-text authentication over the network. Please note that in case this method will be used, your user passwords will be exposed on the local networks, so it will be possible to intercept them
https - use encrypted SSL tunnel to transfer user communications with the HotSpot server. Note that in order this to work, a valid certificate must be imported into the router (see a separate manual on certificate management)
mac - try to use client's MAC address first as its username. If the matching MAC address exists in the local user database or on the RADIUS server, the client will be authenticated without asking to fill the login form
trial - does not require authentication for a certain amount of time
radius-accounting (yes | no; default: yes) - whether to send RADIUS server accounting information on each user once in a while (the "while" is defined in the radius-interim-update property)
radius-default-domain (text; default: "") - default domain to use for RADIUS requests. It allows to select different RADIUS servers depending on HotSpot server profile, but may be handful for single RADIUS server as well.
radius-interim-update (time | received; default: received) - how often to sent cumulative accounting reports.
0s - same as received
received - use whatever value received from the RADIUS server
rate-limit (text; default: "") - Rate limitation in form of rx-rate[/tx-rate] [rx-burst-rate[/tx-burst-rate] [rx-burst-threshold[/tx-burst-threshold] [rx-burst-time[/tx-burst-time]]]] from the point of view of the router (so "rx" is client upload, and "tx" is client download). All rates should be numbers with optional 'k' (1,000s) or 'M' (1,000,000s). If tx-rate is not specified, rx-rate is as tx-rate too. Same goes for tx-burst-rate and tx-burst-threshold and tx-burst-time. If both rx-burst-threshold and tx-burst-threshold are not specified (but burst-rate is specified), rx-rate and tx-rate is used as burst thresholds. If both rx-burst-time and tx-burst-time are not specified, 1s is used as default
smtp-server (IP address; default: 0.0.0.0) - default SMTP server to be used to redirect unconditionally all user SMTP requests to
split-user-domain (yes | no; default: no) - whether to split username from domain name when the username is given in "user@domain" or in "domain\user" format
ssl-certificate (name | none; default: none) - name of the SSL certificate to use for HTTPS authentication. Not used for other authentication methods
trial-uptime (time/time; default: 30m/1d) - is used only when authentication method is trial. Specifies the amount of time the user identified by MAC address can use hotspot services without authentication and the time, that has to pass that the user is allowed to use hotspot services again
trial-user-profile (name; default: default) - is used only only when authentication method is trial. Specifies user profile, that trial users will use
use-radius (yes | no; default: no) - whether to use RADIUS to authenticate HotSpot users



نکاتی مهمی که در اینجا که در اینجا به نظر می رسد:
در قسمت General گزینهHtml Directory مکان قرار گرفتن فایل های وب Login Page است.
بنابراین این امکان وجود دارد که سرورهای مجزای Hotspot login Page *های متفاوتی داشته باشند.برای استفاده از این گزینه باید با نحوه کپی کردن فایل ها در MT با استفاده ازFTP و یا Winbox* آشنا باشید.
در قسمت Rate limit* این امکان وجود دارد که پهنای باند کل یک سرور Hotspot را محدود کنید.
در قسمت HTTP Proxy * می توانید پروکسی سرور مورد استفاده این Hotspot را مشخص کنید.
پس می توانید از پروکسی های مختلف برای سرورهای مختلف استفاده کنید.
مثلا بعضی از Hotspot ها را به کش بفرستید و بعضی دیگر را ...


 


در قسمت Login نوع اعتبار سنجی کاربران را مشخص می کنید.محدود به نوع خاصی نیستید و می توانید چند روش را همزمان انتخاب کنید.
برای مثال برای کاربرهای LAN* که شناخته شده هستند می توانید فقط ازMAC استفاده کنید و برای کاربرهای Wireless *از TTP chap اگر کلاینتی دارید که Windows 98 و ماقبل روی آن نصب شده مجبورید از نوع HTTP PAP * استفاده کنید.
توصیه می کنم اگر از Radius سرور جهت اکانتینگ استفاده می کنید روش cookie* را از کار بیاندازید.
روش Trial* امکانی برای کاربرهایی است که قصد تست سرویس Hotspot شما را دارند.تنظیم های آن در قسمت های دیگر قابل انجام است.توجه داشته باشید که این روش حتما باید با روش های دیگر توامان انجام گیرد.


 



در قسمت Radius مشخص می کنید که این سرور برای اعتبار سنجی و حسابرسی از Radius استفاده کند یا نه.اگر برای اکانتینگ از Radius سرور استفاده می کنید باید تیک Accounting* را بزنید نکته مهم قسمت Interim Update* است.این قسمت را باید طبق تنظیمات Radius سرور خود انجام دهید و الا کاربرهای شما از لیست Online User ها در نرم افزار Radius حذف می شوند در حالی که هنوز متصل هستند.
برای استفاده از این قسمت باید قبلا قسمت Radius* را فعال و تنظیم کرده باشید.


 


در قسمت Users می تونید کاربرهای محلی ایجاد کنید و آنها را به پروفایل های کاربر ارجاع دهید.پروفایل در این قسlت همان نقش قبلی را به عهده دارند.
نکاتی که باید مد نظر قرار دهید این است که همیشه کاربرهای دیتابیس محلی به کاربرهای که از Radius وارد می شوند اولویت دارند بنابراین اگر یوزی هم در MT و هم در Radius سرور تعریف شده باشد کاربر از دیتابیس محلی وارد می شود.
دیگر اینکه یوزهایی که از Radius وارد می شوند به پروفایل Defaul* ارجاع داده می شوند بنابراین راهی برای ایجاد پروفایل خاص برای کاربران Radius وجود ندارد(احتمالا)
با فشردن گزینه + امکان اضافه کردن کاربر را دارید.


 


HotSpot Users
Submenu level: /ip hotspot user

Property Description

address (IP address; default: 0.0.0.0) - static IP address. If not 0.0.0.0, client will always get the same IP address. It implies, that only one simultaneous login for that user is allowed. Any existing address will be replaced with this one using the embedded one-to-one NAT
bytes-in (read-only: integer) - total amount of bytes received from user
bytes-out (read-only: integer) - total amount of bytes sent to user
limit-bytes-in (integer; default: 0) - maximum amount of bytes user can transmit (i.e., bytes received from the user)
0 - no limit
limit-bytes-out (integer; default: 0) - maximum amount of bytes user can receive (i.e., bytes sent to the user)
0 - no limit
limit-uptime (time; default: 0s) - total uptime limit for user (pre-paid time)
0s - no limit
mac-address (MAC address; default: 00:00:00:00:00:00) - static MAC address. If not 00:00:00:00:00:00, client is allowed to login only from that MAC address
name (name) - user name. If authentication method is trial, then user name will be set automaticly after following pattern "T-MAC_adress", where MAC_address is trial user Mac address
packets-in (read-only: integer) - total amount of packets received from user (i.e., packets received from the user)
packets-out (read-only: integer) - total amount of packets sent to user (i.e., packets sent to the user)
password (text) - user password
profile (name; default: default) - user profile
routes (text) - routes that are to be registered on the HotSpot gateway when the client is connected. The route format is: "dst-address gateway metric" (for example, "10.1.0.0/24 10.0.0.1 1"). Several routes may be specified separated with commas
server (name | all; default: all) - which server is this user allowed to log in to
uptime (read-only: time) - total time user has been logged in


ایجاد محدودیت حجمی برای کاربر را باید در این قسمت انجام دهید.توانایی محدود کردن زمان آنلاین بودن کاربر را هم دارا هستید.


 


نکاتی که در این قسمت نیاز به توضیح دارند:
در قسمت General*گزینهAutorefresh مشخص می کند که چه زمانی صفحه popup نمایش داده شده به کاربر که وضعیت کاربر را مشخص می کند به روز شود.پیش فرض این گزینه 1 دقیقه است بهتر است انرا به یک ساعت یا بالاتر افزایش دهید.به روز شدن این صفحه کاربرد زیادی ندارد.ولی زمان پایین بروز شدن می تواند کاربرانی که گیم از طریق اینترنت انجام می دهند به شدت تحت تاثیر قرار دهد و حتی باعث هنگ کردن بازی شود.


 


قسمت Advertise برای نشان دادن تبلیغات به کاربر در زمانهای خاص است.


 


 


قسمت بسیار کاربردی این قسمت Script* هست که برای استفاده از این قسمت باید به برنامه نویسی مسلط باشید البته اسکریپت های حرفه ای و رایگانی در forum* میکروتیک برای دانلود وجود دارد.
لازم به توضیح است که اسکریپت ها در زمان ورود و خروج کاربران اعمال می شوند.


 


 


قسمت Active* لیست کاربرهای آنلاین به همراه اطلاعات مفید دیگر را به شما نشان می دهد.تنها نکته اینست که می توانید با فشردن گزینه -***** کاربرها را Kill کنید.


 


 



قسمت Hosts لیستی از IP* های فعال و اختصاص داده شده را به همراه MAC نشان می دهد.
حرف A نشان دهنده نشان دهنده این است که کاربر یک کاربر دیتابیس داخلی بوده و Authurized شده است.
حرفD* نشاندهنده Dynamic بودنIP کاربر است.
مسلم است که این حروف می توانند با هم نشان داده شوند مانند AD


 


 



قسمت IP Bindings* یکی از مهمترین قسمت های Hotspot به شمار میاید.
برای یادگیری این قسمت باید مفهومی به نام One to one nat را درک کنید.
گفتیم که کاربر برای ارتباط با Hotspot باید یک IP* در رنج Hotspot ست کند.برای این مورد الزامی وجود ندارد کاربر می تواند هرIP* دلخواهی ست کند و فقط DNS,Gateway* را سرور hotspot بدهد(در غیر اینصورت صفحه Login نمایش داده نخواهد شد.)تمامی در خواست ها حالا با هر IP* که باشند به Hotspot می رسند و Hotspot درخواست ها را به Login Page* ارجاع می دهد اگر کاربر بتواند با موفقیت مرحله ورود را پشت سر بگذارد و به اصطلاح Authenticate* شود از آن پس Hotspot یک IP* به کاربر اختصاص می دهد که اینIP* معادل IP کاربر است نه الزاما مشابه آن .این تکنیک به One to one nat مشهور است.(Universal Client هم نامیده می شود) پس Hotspot می تواند هرIP آدرسی را * به صورت ترانسپرنت تغییر دهد و این قابلیت بسیار کاربردی است.
اکنون می توانید با IP bindings کار کنید.Mac* آدرس کاربر را مشخص کنید Address را خالی بگذارید و To Address* را با آدرس دلخواه جایگزین کنید.کاربر هر IP هم که ست کند باز با IP* دلخواه شما به شبکه وصل خواهد شد.پس مشکلی به نام IP conflict* نخواهید داشت.
روشی که به شخصه استفاده می کنم و به نظر خودم بهتر جواب می دهد اینگونه است:
همانطور که در شکل می بینید قسمت Mac Address* را خالی گذاشته ام به این دلیل که ممکن است کاربرها MAC*دائم نداشته باشند(مشکلاتی مثل سوختن کارت شبکه یا تعویض سرور که معمول هستند) در عوض به کاربر IP static* اختصاص می دهم و این IP* را به IP* مشابه Bind*می کنم. این کار از به وجود آمدن آشفتگی IP در کنترل پهنای باند جلوگیری می کند.برای اینکه از تعویض IP توسط کاربر جلوگیری کنم Address* اختصاص داده شده به کاربر را در Radius سرور می بندم بنابراین کاربر فقط از IP* تعریف شده امکان اتصال دارد و اگر IP خود را تغییر دهد حتی از Login Page هم نخواهد توانست عبور کند.
نکته مهم دیگر Type اتصال کاربر است که با کلیک کردن روی هر IP که Bind کرده اید می توانید آنرا تنظیم کنید.سه نوع type* مختلف وجود دارد:
Regular: حالت پیش فرض که کاربر باید اعتبار سنجی شود تا وارد شود.
:Bypassed که کاربر را از قید اعتبار سنجی خلاص می کند.یعنی اگر کاربری این آدرس را داشت وارد شود بدون گذر از مرحله اعتبار سنجی
Blocked: که کاربر را بلوکه می کند و کاربر نمی تواند وصل شود.


 


 


 


در مورد قسمت Service Port* اطلاعات کاملی ندارم بنابراین از این قسمت صرفنظر می کنم.


 


 


 



قسمت مهم دیگر Walled-garden* است که اجازه دسترسی کاربران به سایت ها یا IP* های تعریف شده توسط مدیر سیستم را بدون گذر از مرحله اعتبار سنجی می دهد.مثلا می توانید تنظیماتی اعمال کنید که کاربران برای اتصال به سایت شما و چک کردن گزارشات نیازی به وارد کردن کاربر و یا پسورد نداشته باشند و یا ...
کار کردن با این قسمت ساده است و نیازی به توضیح ندارد.
Property Description
action (allow | deny; default: allow) - action to undertake if a packet matches the rule:
allow - allow the access to the page without prior authorization
deny - the authorization is required to access this page
dst-address (IP address) - IP address of the destination web server
dst-host (wildcard; default: "") - domain name of the destination web server (this is a wildcard)
dst-port (integer; default: "") - the TCP port a client has send the request to
method (text) - HTTP method of the request
path (text; default: "") - the path of the request (this is a wildcard)
server (name) - name of the HotSpot server this rule applied to
src-address (IP address) - IP address of the user sending the reque


 


 


------------------------------


راه اندازی hotspot در mikrotik


کانفیگ hotspot در میکروتیک


کانفیگ hotspot در mikrotik


حذف ارسالي ويرايش ارسالي