مشاركة مميزة

إغلاق البورت 80 وحماية الشبكة من مشكلة استنزاف الرصيد Mikrotik

سكربت دمج 12 خط بردج مع حماية للخطوط load balance pcc




سكربت دمج عدد 12 خط بردج بسرعات متساوية في روتر المايكروتك  

متطلبات قبل تنفيذ الاسكربت :

  1-  تغيير اي بي اللست LAN الى اي بي منفذ خروج الشبكة.    

  2- عمل نسخة احتياطية للروتر قبل نسخ الاسكربت.

 3- التأكد من استخدامك ip محلي الذي يشمل ال LIST -not_in_internet

 

اولا: سكربت اضافة الخطوط يرجى تعديل إسم منافذ الخطوط حيث ان الافتراضي في الاسكربت IN و ايضا تعديل اسم المستخدم و كلمة المرور الخاص بمزود الخدمة بلا من 000000-123456


  
/interface pppoe-client
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN1 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out1 password=123456 profile=default \
    service-name="" use-peer-dns=no user=1595517fams
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN2 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out2 password=123456 profile=default \
    service-name="" use-peer-dns=no user=1595519fams
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN3 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out3 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN4 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out4 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN5 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out5 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN6 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out6 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN7 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out7 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN8 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out8 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN9 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out9 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN10 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out10 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN11 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out11 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
add ac-name="" add-default-route=no allow=pap,chap,mschap1,mschap2 \
    dial-on-demand=no disabled=no interface=IN12 max-mru=1500 max-mtu=1492 \
    mrru=disabled name=pppoe-out12 password=123456 profile=default \
    service-name="" use-peer-dns=no user=000000
    

ثانيا: سكربت دمج الخطوط

 


  
 /ip firewall address-list
add list=LAN address=192.168.0.0/24
add address=172.16.0.0/12 comment=RFC6890 list=not_in_internet
add address=192.168.0.0/16 comment=RFC6890 list=not_in_internet
add address=10.0.0.0/8 comment=RFC6890 list=not_in_internet
add address=169.254.0.0/16 comment=RFC6890 list=not_in_internet
add address=127.0.0.0/8 comment=RFC6890 list=not_in_internet
add address=224.0.0.0/4 comment=Multicast list=not_in_internet
add address=198.18.0.0/15 comment=RFC6890 list=not_in_internet
add address=192.0.0.0/24 comment=RFC6890 list=not_in_internet
add address=192.0.2.0/24 comment=RFC6890 list=not_in_internet
add address=198.51.100.0/24 comment=RFC6890 list=not_in_internet
add address=203.0.113.0/24 comment=RFC6890 list=not_in_internet
add address=100.64.0.0/10 comment=RFC6890 list=not_in_internet
add address=240.0.0.0/4 comment=RFC6890 list=not_in_internet
add address=192.88.99.0/24 comment="6to4 relay Anycast [RFC 3068]" list=not_in_internet

/ip firewall mangle
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP1_conn passthrough=yes per-connection-classifier=src-address-and-port:12/0
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP2_conn passthrough=yes per-connection-classifier=src-address-and-port:12/1
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP3_conn passthrough=yes per-connection-classifier=src-address-and-port:12/2
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP4_conn passthrough=yes per-connection-classifier=src-address-and-port:12/3
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP5_conn passthrough=yes per-connection-classifier=src-address-and-port:12/4
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP6_conn passthrough=yes per-connection-classifier=src-address-and-port:12/5
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP7_conn passthrough=yes per-connection-classifier=src-address-and-port:12/6
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP8_conn passthrough=yes per-connection-classifier=src-address-and-port:12/7
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP9_conn passthrough=yes per-connection-classifier=src-address-and-port:12/8
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP10_conn passthrough=yes per-connection-classifier=src-address-and-port:12/9
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP11_conn passthrough=yes per-connection-classifier=src-address-and-port:12/10
add action=mark-connection chain=prerouting  src-address-list=LAN dst-address-list=!not_in_internet new-connection-mark=ISP12_conn passthrough=yes per-connection-classifier=src-address-and-port:12/11




add action=mark-routing chain=prerouting connection-mark=ISP1_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP2_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r2 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP3_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r3 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP4_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r4 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP5_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r5 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP6_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r6 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP7_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r7 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP8_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r8 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP9_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r9 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP10_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r10 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP11_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r11 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ISP12_conn \
    src-address-list=LAN dst-address-list=!not_in_internet new-routing-mark=r12 passthrough=yes


/ip route

add distance=1 gateway=pppoe-out2,pppoe-out3,pppoe-out4

add distance=1 gateway=pppoe-out1 routing-mark=r1

add distance=1 gateway=pppoe-out2 routing-mark=r2

add distance=1 gateway=pppoe-out3 routing-mark=r3

add distance=1 gateway=pppoe-out4 routing-mark=r4

add distance=1 gateway=pppoe-out5 routing-mark=r5

add distance=1 gateway=pppoe-out6 routing-mark=r6

add distance=1 gateway=pppoe-out7 routing-mark=r7

add distance=1 gateway=pppoe-out8 routing-mark=r8

add distance=1 gateway=pppoe-out9 routing-mark=r9

add distance=1 gateway=pppoe-out10 routing-mark=r10

add distance=1 gateway=pppoe-out11 routing-mark=r11

add distance=1 gateway=pppoe-out12 routing-mark=r12 
  

ثالثا :سكربت الحماية

 


 /interface list

add name=PPPOE


{

:foreach i in=[/interface pppoe-client find ] do={

:local a [/interface pppoe-client get $i name];

/interface list member add list=PPPOE interface=$a comment=salmandahmash;

}

}


/ip firewall raw

add action=drop chain=prerouting dst-port=53 in-interface-list=PPPOE protocol=tcp

add action=drop chain=prerouting dst-port=53 in-interface-list=PPPOE protocol=udp
    

تعليقات

  1. ممتاز جزاك الله كل خير
    نتمنى إعادة الشرح على النسخة 7

    ردحذف

إرسال تعليق