Advertisement
Guest User

Mikrotik Rules

a guest
Nov 24th, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.59 KB | None | 0 0
  1. /ip firewall layer7-protocol
  2. add name=sip regexp="^(invite|register|cancel|message|subscribe|notify) sip[\\x09-\\x0d -~]*sip/[0-2]\\.[0-9]"
  3. add name=skypetoskype regexp="^..\\x02............."
  4. add comment="Skype<->POTS phone calls" name=skypeout regexp="^(\\x01.\?.\?.\?.\?.\?.\?.\?.\?\\x01|\\x02.\?.\?.\?.\?.\?.\?.\?.\?\\x02|\\x03.\?.\?.\?.\?.\?.\?.\?.\?\\x0\
  5. 3|\\x04.\?.\?.\?.\?.\?.\?.\?.\?\\x04|\\x05.\?.\?.\?.\?.\?.\?.\?.\?\\x05|\\x06.\?.\?.\?.\?.\?.\?.\?.\?\\x06|\\x07.\?.\?.\?.\?.\?.\?.\?.\?\\x07|\\x08.\?.\?.\?.\?.\?\
  6. .\?.\?.\?\\x08|\\x09.\?.\?.\?.\?.\?.\?.\?.\?\\x09|\\x0a.\?.\?.\?.\?.\?.\?.\?.\?\\x0a|\\x0b.\?.\?.\?.\?.\?.\?.\?.\?\\x0b|\\x0c.\?.\?.\?.\?.\?.\?.\?.\?\\x0c|\\x0d.\
  7. \?.\?.\?.\?.\?.\?.\?.\?\\x0d|\\x0e.\?.\?.\?.\?.\?.\?.\?.\?\\x0e|\\x0f.\?.\?.\?.\?.\?.\?.\?.\?\\x0f|\\x10.\?.\?.\?.\?.\?.\?.\?.\?\\x10|\\x11.\?.\?.\?.\?.\?.\?.\?.\
  8. \?\\x11|\\x12.\?.\?.\?.\?.\?.\?.\?.\?\\x12|\\x13.\?.\?.\?.\?.\?.\?.\?.\?\\x13|\\x14.\?.\?.\?.\?.\?.\?.\?.\?\\x14|\\x15.\?.\?.\?.\?.\?.\?.\?.\?\\x15|\\x16.\?.\?.\?\
  9. .\?.\?.\?.\?.\?\\x16|\\x17.\?.\?.\?.\?.\?.\?.\?.\?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et-mark=internet-in
  62. /ip firewall mangle add action=mark-packet chain=prerouting comment="ICMP responses" \
  63. in-interface="pppoe-out1" new-packet-mark=icmp_in passthrough=no \
  64. protocol=icmp
  65. /ip firewall mangle add action=mark-packet chain=postrouting comment="ICMP requests to WAN" \
  66. new-packet-mark=icmp_out out-interface="pppoe-out1" passthrough=no \
  67. protocol=icmp
  68. /ip firewall mangle add action=mark-packet chain=prerouting comment="DNS response packets" \
  69. in-interface="pppoe-out1" new-packet-mark=dns_in passthrough=no protocol=\
  70. udp src-port=53
  71. /ip firewall mangle add action=mark-packet chain=postrouting comment="DNS request packets" \
  72. dst-port=53 new-packet-mark=dns_out out-interface="pppoe-out1" \
  73. passthrough=no protocol=udp
  74. /ip firewall mangle add action=mark-packet chain=prerouting comment="SIP from WAN" \
  75. connection-type=sip in-interface="pppoe-out1" new-packet-mark=sip_in \
  76. passthrough=no
  77. /ip firewall mangle add action=mark-packet chain=postrouting comment="SIP to WAN" \
  78. connection-type=sip new-packet-mark=sip_out out-interface="pppoe-out1" \
  79. passthrough=no
  80. /ip firewall mangle add action=mark-packet chain=prerouting comment=\
  81. "Skype->Skype from WAN (Layer7, false positives/negatives possible)" \
  82. in-interface="pppoe-out1" layer7-protocol=skypetoskype new-packet-mark=\
  83. skype_in passthrough=no
  84. /ip firewall mangle add action=mark-packet chain=postrouting comment=\
  85. "Skype->Skype to WAN (Layer7, false positives/negatives possible)" \
  86. layer7-protocol=skypetoskype new-packet-mark=skype_out out-interface=\
  87. "pppoe-out1" passthrough=no
  88. /ip firewall mangle add action=mark-packet chain=prerouting comment=\
  89. "Small HTTP sessions from WAN" connection-bytes=0-500000 in-interface=\
  90. "pppoe-out1" new-packet-mark=small_http_in passthrough=no protocol=tcp \
  91. src-port=80,443
  92. /ip firewall mangle add action=mark-packet chain=postrouting comment="Small HTTP session to WAN" \
  93. connection-bytes=0-100000 dst-port=80,443 new-packet-mark=small_http_out \
  94. out-interface="pppoe-out1" passthrough=no protocol=tcp
  95. /ip firewall mangle add action=mark-packet chain=prerouting comment=\
  96. "Skype<->POTS from WAN (Layer7; CPU heavy)" in-interface="pppoe-out1" \
  97. layer7-protocol=skypeout new-packet-mark=skype_in passthrough=no \
  98. protocol=udp
  99. /ip firewall mangle add action=mark-packet chain=postrouting comment=\
  100. "Skype<->POTS to WAN (Layer7; CPU heavy)" layer7-protocol=skypeout \
  101. new-packet-mark=skype_out out-interface="pppoe-out1" passthrough=no \
  102. protocol=udp
  103. /ip firewall mangle add action=mark-packet chain=prerouting comment="Other packets from WAN" \
  104. in-interface="pppoe-out1" new-packet-mark=other_in passthrough=no
  105. /ip firewall mangle add action=mark-packet chain=postrouting comment="Other packets to WAN" \
  106. new-packet-mark=other_out out-interface="pppoe-out1" passthrough=no
  107. /ip firewall mangle add action=mark-packet chain=prerouting disabled=yes in-interface=\
  108. "pppoe-out1" new-packet-mark=internet-in
  109. /ip firewall mangle add action=mark-packet chain=prerouting comment="ICMP responses" \
  110. in-interface="pppoe-out1" new-packet-mark=icmp_in passthrough=no \
  111. protocol=icmp
  112. /ip firewall mangle add action=mark-packet chain=postrouting comment="ICMP requests to WAN" \
  113. new-packet-mark=icmp_out out-interface="pppoe-out1" passthrough=no \
  114. protocol=icmp
  115. /ip firewall mangle add action=mark-packet chain=prerouting comment="DNS response packets" \
  116. in-interface="pppoe-out1" new-packet-mark=dns_in passthrough=no protocol=\
  117. udp src-port=53
  118. /ip firewall mangle add action=mark-packet chain=postrouting comment="DNS request packets" \
  119. dst-port=53 new-packet-mark=dns_out out-interface="pppoe-out1" \
  120. passthrough=no protocol=udp
  121. /ip firewall mangle add action=mark-packet chain=prerouting comment="SIP from WAN" \
  122. connection-type=sip in-interface="pppoe-out1" new-packet-mark=sip_in \
  123. passthrough=no
  124. /ip firewall mangle add action=mark-packet chain=postrouting comment="SIP to WAN" \
  125. connection-type=sip new-packet-mark=sip_out out-interface="pppoe-out1" \
  126. passthrough=no
  127. /ip firewall mangle add action=mark-packet chain=prerouting comment=\
  128. "Skype->Skype from WAN (Layer7, false positives/negatives possible)" \
  129. in-interface="pppoe-out1" layer7-protocol=skypetoskype new-packet-mark=\
  130. skype_in passthrough=no
  131. /ip firewall mangle add action=mark-packet chain=postrouting comment=\
  132. "Skype->Skype to WAN (Layer7, false positives/negatives possible)" \
  133. layer7-protocol=skypetoskype new-packet-mark=skype_out out-interface=\
  134. "pppoe-out1" passthrough=no
  135. /ip firewall mangle add action=mark-packet chain=prerouting comment=\
  136. "Small HTTP sessions from WAN" connection-bytes=0-500000 in-interface=\
  137. "pppoe-out1" new-packet-mark=small_http_in passthrough=no protocol=tcp \
  138. src-port=80,443
  139. /ip firewall mangle add action=mark-packet chain=postrouting comment="Small HTTP session to WAN" \
  140. connection-bytes=0-100000 dst-port=80,443 new-packet-mark=small_http_out \
  141. out-interface="pppoe-out1" passthrough=no protocol=tcp
  142. /ip firewall mangle add action=mark-packet chain=prerouting comment=\
  143. "Skype<->POTS from WAN (Layer7; CPU heavy)" in-interface="pppoe-out1" \
  144. layer7-protocol=skypeout new-packet-mark=skype_in passthrough=no \
  145. protocol=udp
  146. /ip firewall mangle add action=mark-packet chain=postrouting comment=\
  147. "Skype<->POTS to WAN (Layer7; CPU heavy)" layer7-protocol=skypeout \
  148. new-packet-mark=skype_out out-interface="pppoe-out1" passthrough=no \
  149. protocol=udp
  150. /ip firewall mangle add action=mark-packet chain=prerouting comment="Other packets from WAN" \
  151. in-interface="pppoe-out1" new-packet-mark=other_in passthrough=no
  152. /ip firewall mangle add action=mark-packet chain=postrouting comment="Other packets to WAN" \
  153. new-packet-mark=other_out out-interface="pppoe-out1" passthrough=no
  154.  
  155. /queue tree add max-limit=35M name=input packet-mark=input parent=global priority=1
  156. /queue tree add max-limit=10M name=output packet-mark=output parent=global priority=1
  157. /queue tree add max-limit=35M name=sip_in packet-mark=sip_in parent=input priority=2 \
  158. queue=default
  159. /queue tree add max-limit=10M name=sip_out packet-mark=sip_out parent=output priority=2 \
  160. queue=default
  161. /queue tree add max-limit=30M name=other_in packet-mark=other_in parent=input queue=\
  162. default
  163. /queue tree add max-limit=8M name=other_out packet-mark=other_out parent=output queue=\
  164. default
  165. /queue tree add max-limit=30M name=small_http_in packet-mark=small_http_in parent=input \
  166. priority=7 queue=default
  167. /queue tree add max-limit=8M name=small_http_out packet-mark=small_http_out parent=\
  168. output priority=7 queue=default
  169. /queue tree add comment="Traffic queues of different classes - for QoS. Can restrict data \
  170. rate/set priority here.\
  171. \nNote that these rules use packet marks in order to identify traffic.\
  172. \nSee IP -> Firewall -> Mangle for marking rules" max-limit=35M name=\
  173. dns_in packet-mark=dns_in parent=input priority=1 queue=default
  174. /queue tree add max-limit=10M name=dns_out packet-mark=dns_out parent=output priority=1 \
  175. queue=default
  176. /queue tree add max-limit=35M name=skype_in packet-mark=skype_in parent=input priority=3 \
  177. queue=default
  178. /queue tree add max-limit=10M name=skype_out packet-mark=skype_out parent=output \
  179. priority=3 queue=default
  180. /queue tree add max-limit=35M name=icmp_in packet-mark=icmp_in parent=input priority=1 \
  181. queue=default
  182. /queue tree add max-limit=10M name=icmp_out packet-mark=icmp_out parent=output priority=\
  183. 1 queue=default
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement