توجه :
| میکروتیک - بخش اول - معرفی |
| نگارش یافته توسط شاهین غرقی | |
|
MikroTik یک سرور مبتنی بر kernel لینوکس است که بر روی یک pc معمولی قابل نصب و سرویس دهی به صورت کاملا پایدار است.
MikroTik ویژگی های زیادی دارد که برخی از آنها را ذکر میکنیم. یکی از ویژگی های MikroTik این است که اکثر سرویسهای آن مانند NAT , Bandwidth Manager , Filtering و ... بر روی Layer3 انجام می پذیرد و به همین دلیل نیازی به لایه های بالاتر ندارد که این خود مقدار قابل توجهی در بالا بردن کیفیت و performance سیستم تاثیر دارد. این امر به ما این امکان را می دهد که بر روی یک pc معمولی به عنوان مثال یک کامپیوتر Pentium 2 با 64M فضای RAM مقدار زیادی پهنای باند را رد کرده و اعمالی مثل NAT و Filtering روی آنها انجام دهیم. در واقع MikroTik از pc های ما یک router کارآمد می سازد و این امکان را به ما می دهد که به آسانی بر روی آن پورتهای مختلف را اضافه و کم کنیم. یکی دیگر از ویژگی های MikroTik پایداری آن است. MikroTik همانند یک روتر قوی از سرعت بوت بالا و عملکرد خودکار بدون نیاز به هیچ گونه login یا استارت کردن هر نوع سرویس بر خوردار است. علاوه بر دسترسی محلی می توان MikroTik را به وسیله Telnet و SSH و Web server داخلی آن و رابط ویندوزی ارائه شده به همراه MikroTik به نام Winbox تنظیم کرد. دیگر قابلیت قابل توجه MikroTik سرعت نصب و سرعت تنظیمات آن است. MikroTik در عرض چند دقیقه نصب و براحتی تنظیم میشود و این قابلیت در آن وجود دارد که بتوان تنظیمات آن را Import و Export کرد. دیگر نقطه قوت MikroTik به صرفه بودن آن نسبت به نمونه های مشابه سخت افزاری است. با خرید یک عدد RouterOs و یک سرور با قدرتی متناسب با کار ما میتوانیم کارایی گرانفیمت ترین سخت افزارهارا با چندین برابر هزینه کمتر داشته باشیم. البته بماند که ما اکثرا از ورژن های کرک شده استفاده کرده و آنچنان پهنای باندی نداریم که بیشتر از یک کامپیوتر P3 نیاز شود. در ادامه بعد از توضیح و آموزش NAT, Filtering توسط MikroTik به یک مثال برای یادگیری بیشتر خواهیم پرداحت.
NAT:
NAT یا Network Address Translation یک استاندارد در اینترنت است که به کامپیوتر های داحل یک شبکه این اجازه را می دهد که از یک رنج IP برای ارتباط داخلی و از یک رنج دیکر برای ارتباط خارجی استفاده کنند. به شبکه داحلی که از NAT استفاده می کند اصطلاحا Natted Network می گویند. برای ایجاد NAT باید در شبکه داخلی یک عدد NAT gateway داشته باشیم که ترجمه آدرسها در آن صورت گیرد.
در کل 2 نوع NAT وجود دارد
· SRCNAT یا Source Nat : از این فرم Nat وقتی استفاده میکنیم که می خواهیم IP های Invalid یک شبکه داخلی یا Natted Network را به یک Valid IP ترجمه کنیم.در این حالت هر پکتی که به gateway برسد IP آن به یک Valid IP ترجمه گشته و بر روی اینترنت ارسال می شود. عکس این عمل برای پکت هایی که به پکت های قبلی Reply می شوند صادق است و عکس این عمل صورت میگیرد.
· DSTNAT یا Destination Nat : این فرم NAT را وقتی انجام می دهیم که بخواهیم یک شبکه private را برای شبکه public خود قابل دسترسی قرار دهیم. در این عمل Valid IP خود را به Invalid IP ترجمه میکنیم.
Redirect و Masquerade
Redirect و Masquerade یک نوع خاص dstnat و srcnat است. Redirect یک نوع از dstnat است که نیازی به تعریف to-address ندارد و تنها شناساندن اینترفیس ورودی کافی است و Masquerade یک نوع srcnat است که نیازی به تعریف to-address ندارد و تنها معرفی یک اینترفیس خروجی کافی است. در این حالات دیگر فرقی ندارد که چه IP به اینترفیس ها متصل میگردد هر IP در رنج IP های add شده به اینترفیس عمل می کند. در Redirect فیلد to-port برای فرستادن کل ترافیک به یک پورت خاص است که بیشتر برای اعمالی نظیر web-proxy استفاده می شود.
Property Description action (accept | add-dst-to-address-list | add-src-to-address-list | dst-nat | jump | log | masquerade | netmap | passthrough | redirect | return | same | src-nat; default: accept) - action to undertake if the packet matches the rule
accept
- accepts the packet. No action is taken, i.e. the packet is passed through and
no more rules are applied to it address-list (name) - specifies the name of the address list to collect IP addresses from rules having action=add-dst-to-address-list or action=add-src-to-address-list actions. These address lists could be later used for packet matching address-list-timeout (time; default: 00:00:00) - time interval after which the address will be removed from the address list specified by address-list parameter. Used in conjunction with add-dst-to-address-list or add-src-to-address-list actions 00:00:00 - leave the address in the address list forever chain (dstnat | srcnat | name) - specifies the chain to put a particular rule into. As the different traffic is passed through different chains, always be careful in choosing the right chain for a new rule. If the input does not match the name of an already defined chain, a new chain will be created
dstnat
- a rule placed in this chain is applied before routing. The rules that replace
destination addresses of IP packets should be placed there comment (text) - a descriptive comment for the rule. A comment can be used to identify rules form scripts connection-bytes (integer-integer) - matches packets only if a given amount of bytes has been transfered through the particular connection 0 - means infinity, exempli gratia: connection-bytes=2000000-0 means that the rule matches if more than 2MB has been transfered through the relevant connection connection-limit (integer,netmask) - restrict connection limit per address or address block connection-mark (name) - matches packets marked via mangle facility with particular connection mark connection-type (ftp | gre | h323 | irc | mms | pptp | quake3 | tftp) - matches packets from related connections based on information from their connection tracking helpers. A relevant connection helper must be enabled under /ip firewall service-port content (text) - the text packets should contain in order to match the rule dst-address (IP address/netmask | IP address-IP address) - specifies the address range an IP packet is destined to. Note that console converts entered address/netmask value to a valid network address, i.e.:1.1.1.1/24 is converted to 1.1.1.0/24 dst-address-list (name) - matches destination address of a packet against user-defined address list dst-address-type (unicast | local | broadcast | multicast) - matches destination address type of the IP packet, one of the:
unicast
- IP addresses used for one point to another point transmission. There is only
one sender and one receiver in this case dst-limit (integer/time{0,1},integer,dst-address | dst-port | src-address{+},time{0,1}) - limits the packet per second (pps) rate on a per destination IP or per destination port base. As opposed to the limit match, every destination IP address / destination port has it's own limit. The options are as follows (in order of appearance):
Count
- maximum average packet rate, measured in packets per second (pps), unless
followed by Time option dst-port (integer: 0..65535-integer: 0..65535{*}) - destination port number or range hotspot (multiple choice: from-client | auth | local-dst) - matches packets received from clients against various Hot-Spot. All values can be negated
from-client
- true, if a packet comes from HotSpot client icmp-options (integer:integer) - matches ICMP Type:Code fields in-interface (name) - interface the packet has entered the router through ipv4-options (any | loose-source-routing | no-record-route | no-router-alert | no-source-routing | no-timestamp | none | record-route | router-alert | strict-source-routing | timestamp) - match ipv4 header options
any
- match packet with at least one of the ipv4 options jump-target (dstnat | srcnatname) - name of the target chain to jump to, if the action=jump is used limit (integer/time{0,1},integer) - restricts packet match rate to a given limit. Usefull to reduce the amount of log messages
Count
- maximum average packet rate, measured in packets per second (pps), unless
followed by Time option log-prefix (text) - all messages written to logs will contain the prefix specified herein. Used in conjunction with action=log nth (integer,integer: 0..15,integer{0,1}) - match a particular Nth packet received by the rule. One of 16 available counters can be used to count packets
Every
- match every Every+1th packet. For example, if Every=1 then the
rule matches every 2nd packet out-interface (name) - interface the packet is leaving the router through packet-mark (text) - matches packets marked via mangle facility with particular packet mark packet-size (integer: 0..65535-integer: 0..65535{0,1}) - matches packet of the specified size or size range in bytes
Min
- specifies lower boundary of the size range or a standalone value phys-in-interface (name) - matches the bridge port physical input device added to a bridge device. It is only useful if the packet has arrived through the bridge phys-out-interface (name) - matches the bridge port physical output device added to a bridge device. It is only useful if the packet will leave the router through the bridge protocol (ddp | egp | encap | ggp | gre | hmp | icmp | idrp-cmtp | igmp | ipencap | ipip | ipsec-ah | ipsec-esp | iso-tp4 | ospf | pup | rdp | rspf | st | tcp | udp | vmtp | xns-idp | xtp | integer) - matches particular IP protocol specified by protocol name or number. You should specify this setting if you want to specify ports psd (integer,time,integer,integer) - attempts to detect TCP and UDP scans. It is advised to assign lower weight to ports with high numbers to reduce the frequency of false positives, such as from passive mode FTP transfers
WeightThreshold
- total weight of the latest TCP/UDP packets with different destination ports
coming from the same host to be treated as port scan sequence random (integer) - match packets randomly with given propability routing-mark (name) - matches packets marked by mangle facility with particular routing mark same-not-by-dst (yes | no) - specifies whether to account or not to account for destination IP address when selecting a new source IP address for packets matched by rules with action=same src-address (IP address/netmask | IP address-IP address) - specifies the address range an IP packet is originated from. Note that console converts entered address/netmask value to a valid network address, i.e.:1.1.1.1/24 is converted to 1.1.1.0/24 src-address-list (name) - matches source address of a packet against user-defined address list src-address-type (unicast | local | broadcast | multicast) - matches source address type of the IP packet, one of the:
unicast
- IP addresses used for one point to another point transmission. There is only
one sender and one receiver in this case src-mac-address (MAC address) - source MAC address src-port (integer: 0..65535-integer: 0..65535{*}) - source port number or range tcp-mss (integer: 0..65535) - matches TCP MSS value of an IP packet time (time-time,sat | fri | thu | wed | tue | mon | sun{+}) - allows to create filter based on the packets' arrival time and date or, for locally generated packets, departure time and date to-addresses (IP address-IP address{0,1}; default: 0.0.0.0) - address or address range to replace original address of an IP packet with to-ports (integer: 0..65535-integer: 0..65535{0,1}) - port or port range to replace original port of an IP packet with tos (max-reliability | max-throughput | min-cost | min-delay | normal) - specifies a match to the value of Type of Service (ToS) field of IP header
max-reliability
- maximize reliability (ToS=4)
Filter
Filter یک بخش از فایروال است. فایروال چیست؟ فایروال در لغت به معنی دیواره آتش است اما در مفهوم مانند یک دیوار است که دور یک شهر کشیده شده و معابری مانند دروازه های شهر در آن وجود دارد که نگهبانانی در آنها وجود دارند که عبور و مرور را کنترل می نمایند. در شبکه فایروال ها معمولا روی gateway نصب می شوند و تمامی عبور و مرور ها را کنترل می نمایند. که معمولا کار حفاظت اطلاعات داخلی را از هجوم های خارجی را بر عهده دارد. فایروالها ممکن است استراتژی های مختلفی داشته باشند.که به نوع شبکه و نوع و level حفاظت بستگی دارد. MikroTik دارای یکpacket filter قوی است که ویژگی های آن در زیر آورده شده است.
قائده کلی Filtering
فایروال بر پایه رول های آن بنا شده است یعنی فایروال و روتر کاری را انجام می دهد که رول ها بگویند. هر رول از 2 قسمت تشکیل شده است قسمت اول مشخص می کند که کدام پکت با رول ما match میشود و قسمت دوم عملی که روی پکت باید انجام بگیرد را مشخص می کند. رول ها بر اساس chain آنها برای مدیریت بهتر دسته بندی می شوند. هر رول 3 حالت به صورت پیش فرض میتواند داشته باشد. Input و forward و output که به معنی پکت هایی که به مقصد روتر می آیند و پکت هایی که از روتر رد می شوند و پکت هایی که از مبدا روتر خارج می شوند هستند. حالتهایی هم به صورت دستی می توان برای فایروال تعریف کرد.
Property Description action (accept | add-dst-to-address-list | add-src-to-address-list | drop | jump | log | passthrough | reject | return | tarpit; default: accept) - action to undertake if the packet matches the rule
accept
- accept the packet. No action is taken, i.e. the packet is passed through and
no more rules are applied to it address-list (name) - specifies the name of the address list to collect IP addresses from rules having action=add-dst-to-address-list or action=add-src-to-address-list actions. These address lists could be later used for packet matching address-list-timeout (time; default: 00:00:00) - time interval after which the address will be removed from the address list specified by address-list parameter. Used in conjunction with add-dst-to-address-list or add-src-to-address-list actions 00:00:00 - leave the address in the address list forever chain (forward | input | output | name) - specifies the chain to put a particular rule into. As the different traffic is passed through different chains, always be careful in choosing the right chain for a new rule. If the input does not match the name of an already defined chain, a new chain will be created comment (text) - a descriptive comment for the rule. A comment can be used to identify rules form scripts connection-bytes (integer-integer) - matches packets only if a given amount of bytes has been transfered through the particular connection 0 - means infinity, exempli gratia: connection-bytes=2000000-0 means that the rule matches if more than 2MB has been transfered through the relevant connection connection-limit (integer,netmask) - restrict connection limit per address or address block connection-mark (name) - matches packets marked via mangle facility with particular connection mark connection-state (estabilished | invalid | new | related) - interprets the connection tracking analysis data for a particular packet
estabilished
- a packet which belongs to an existing connection, exempli gratia a
reply packet or a packet which belongs to already replied connection connection-type (ftp | gre | h323 | irc | mms | pptp | quake3 | tftp) - matches packets from related connections based on information from their connection tracking helpers. A relevant connection helper must be enabled under /ip firewall service-port content (text) - the text packets should contain in order to match the rule dst-address (IP address/netmask | IP address-IP address) - specifies the address range an IP packet is destined to. Note that console converts entered address/netmask value to a valid network address, i.e.:1.1.1.1/24 is converted to 1.1.1.0/24 dst-address-list (name) - matches destination address of a packet against user-defined address list dst-address-type (unicast | local | broadcast | multicast) - matches destination address type of the IP packet, one of the:
unicast
- IP addresses used for one point to another point transmission. There is only
one sender and one receiver in this case dst-limit (integer/time{0,1},integer,dst-address | dst-port | src-address{+},time{0,1}) - limits the packet per second (pps) rate on a per destination IP or per destination port base. As opposed to the limit match, every destination IP address / destination port has it's own limit. The options are as follows (in order of appearance):
Count
- maximum average packet rate, measured in packets per second (pps), unless
followed by Time option dst-port (integer: 0..65535-integer: 0..65535{*}) - destination port number or range hotspot (multiple choice: from-client | auth | local-dst | http) - matches packets received from clients against various Hot-Spot. All values can be negated
from-client
- true, if a packet comes from HotSpot client icmp-options (integer:integer) - matches ICMP Type:Code fields in-interface (name) - interface the packet has entered the router through ipv4-options (any | loose-source-routing | no-record-route | no-router-alert | no-source-routing | no-timestamp | none | record-route | router-alert | strict-source-routing | timestamp) - match ipv4 header options
any
- match packet with at least one of the ipv4 options jump-target (forward | input | output | name) - name of the target chain to jump to, if the action=jump is used limit (integer/time{0,1},integer) - restricts packet match rate to a given limit. Usefull to reduce the amount of log messages
Count
- maximum average packet rate, measured in packets per second (pps), unless
followed by Time option log-prefix (text) - all messages written to logs will contain the prefix specified herein. Used in conjunction with action=log nth (integer,integer: 0..15,integer{0,1}) - match a particular Nth packet received by the rule. One of 16 available counters can be used to count packets
Every
- match every Every+1th packet. For example, if Every=1 then the
rule matches every 2nd packet out-interface (name) - interface the packet will leave the router through p2p (all-p2p | bit-torrent | blubster | direct-connect | edonkey | fasttrack | gnutella | soulseek | warez | winmx) - matches packets from various peer-to-peer (P2P) protocols packet-mark (text) - matches packets marked via mangle facility with particular packet mark packet-size (integer: 0..65535-integer: 0..65535{0,1}) - matches packet of the specified size or size range in bytes
Min
- specifies lower boundary of the size range or a standalone value phys-in-interface (name) - matches the bridge port physical input device added to a bridge device. It is only useful if the packet has arrived through the bridge phys-out-interface (name) - matches the bridge port physical output device added to a bridge device. It is only useful if the packet will leave the router through the bridge protocol (ddp | egp | encap | ggp | gre | hmp | icmp | idrp-cmtp | igmp | ipencap | ipip | ipsec-ah | ipsec-esp | iso-tp4 | ospf | pup | rdp | rspf | st | tcp | udp | vmtp | xns-idp | xtp | integer) - matches particular IP protocol specified by protocol name or number. You should specify this setting if you want to specify ports psd (integer,time,integer,integer) - attempts to detect TCP and UDP scans. It is advised to assign lower weight to ports with high numbers to reduce the frequency of false positives, such as from passive mode FTP transfers
WeightThreshold
- total weight of the latest TCP/UDP packets with different destination ports
coming from the same host to be treated as port scan sequence random (integer: 1..99) - matches packets randomly with given propability reject-with (icmp-admin-prohibited | icmp-echo-reply | icmp-host-prohibited | icmp-host-unreachable | icmp-net-prohibited | icmp-network-unreachable | icmp-port-unreachable | icmp-protocol-unreachable | tcp-reset | integer) - alters the reply packet of reject action routing-mark (name) - matches packets marked by mangle facility with particular routing mark src-address (IP address/netmask | IP address-IP address) - specifies the address range an IP packet is originated from. Note that console converts entered address/netmask value to a valid network address, i.e.:1.1.1.1/24 is converted to 1.1.1.0/24 src-address-list (name) - matches source address of a packet against user-defined address list src-address-type (unicast | local | broadcast | multicast) - matches source address type of the IP packet, one of the:
unicast
- IP addresses used for one point to another point transmission. There is only
one sender and one receiver in this case src-mac-address (MAC address) - source MAC address src-port (integer: 0..65535-integer: 0..65535{*}) - source port number or range tcp-flags (ack | cwr | ece | fin | psh | rst | syn | urg) - tcp flags to match
ack
- acknowledging data tcp-mss (integer: 0..65535) - matches TCP MSS value of an IP packet time (time-time,sat | fri | thu | wed | tue | mon | sun{+}) - allows to create filter based on the packets' arrival time and date or, for locally generated packets, departure time and date tos (max-reliability | max-throughput | min-cost | min-delay | normal) - specifies a match for the value of Type of Service (ToS) field of an IP header
max-reliability
- maximize reliability (ToS=4)
|
| < بعد |
|---|
آخرين مراجعات
| www.google.com |
| images.google.com |
| admins.ir |
| forum.admins.ir |
| www.google.co.ma |
| ...rezabehroozi.ir |
| ..velopercenter.ir |
| ..ersianadmins.com |
آخرین ارسالهای انجمن
Cache Directory Unwriteable



