دمج ثلاثة خطوط على نظام المايكروتك



دمج ثلاثة خطوط على نظام المايكروتك مع دعم Failover balance
سكربت لدمج ثلاثة خطوط على نظام المايكروتك مع دعم Failover balance أي في حالة سقوط أي الخطوط يتم توزيع الأحمال على الخطوط الباقة.
أولاً سنفترض أن لدينا أربع مخارج شبكة أسمائهم كالتالي
WAN1 >>> واصل بالراوتر الأول وعنوان الآيبي الخاص به هو 192.168.1.1
الإسم | مرتبط ب | عنوان الآيبي |
WAN1 | الراوتر الأول | 192.168.1.1 |
WAN2 | الراوتر الثاني | 192.168.2.1 |
WAN3 | الراوتر الثالث | 192.168.3.1 |
LAN | الشبكة الداخلية | 123.0.0.1 |
ثانيا الجزء الخالص بال Routes
نقوم بفتح New Terminal من ال Winbox
نقوم بنسخ الكود التالي ولصقة
/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=”192.168.1.1″ routing-mark=to_WAN1 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=”192.168.2.1″ routing-mark=to_WAN2 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=”192.168.3.1″ routing-mark=to_WAN3 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=”192.168.1.1″ scope=30 target-scope=10
add check-gateway=ping disabled=no distance=2 dst-address=0.0.0.0/0 gateway=”192.168.2.1″ scope=30 target-scope=10
add check-gateway=ping disabled=no distance=3 dst-address=0.0.0.0/0 gateway=”192.168.3.1″ scope=30 target-scope=10
ثم نقوم بالضغط على زر Enter
ثالثاً الجزء الخاص بال Firewall Mangle
قم بنسخ النص التالي ولصقة في ال Terminal
/ip firewall mangle
add action=mark-connection chain=input disabled=no in-interface=WAN1 new-connection-mark=WAN1_conn passthrough=yes
add action=mark-connection chain=input disabled=no in-interface=WAN2 new-connection-mark=WAN2_conn passthrough=yes
add action=mark-connection chain=input disabled=no in-interface=WAN3 new-connection-mark=WAN3_conn passthrough=yes
add action=mark-routing chain=output connection-mark=WAN1_conn disabled=no new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN2_conn disabled=no new-routing-mark=to_WAN2 passthrough=yes
add action=mark-routing chain=output connection-mark=WAN3_conn disabled=no new-routing-mark=to_WAN3 passthrough=yes
add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=WAN1_conn passthrough=yes per-connection-classifier=both-addresses-and-ports:3/0
add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=WAN2_conn passthrough=yes per-connection-classifier=both-addresses-and-ports:3/1
add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=WAN3_conn passthrough=yes per-connection-classifier=both-addresses-and-ports:3/2
add action=mark-routing chain=prerouting connection-mark=WAN1_conn disabled=no in-interface=LAN new-routing-mark=to_WAN1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN2_conn disabled=no in-interface=LAN new-routing-mark=to_WAN2 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=WAN3_conn disabled=no in-interface=LAN new-routing-mark=to_WAN3 passthrough=yes
ثم نقوم بالضغط على زر Enter
رابعاً الجزءالخاص بال Firewall Nat
قم بنسخ النص التالي ولصقة في ال Terminal
/ip firewall nat
add action=masquerade chain=srcnat disabled=no out-interface=”WAN1″
add action=masquerade chain=srcnat disabled=no out-interface=”WAN2″
add action=masquerade chain=srcnat disabled=no out-interface=”WAN3″ثم نقوم بالضغط على زر Enter
تلك الإعدادات لن تعمل اذا كنت قددمج ما نصبت الهوتسبوت Hotspot على نفس الجهاز
لذلك إذا كنت تُريد تنصيب الهوتسبوت وعمل الدمج على نفس الجهاز سيكون هناك تعديل أولا في الجزء الثالث بعمل التالي
قم حذف السابق من قائمة ip >> firewall >> mangle
وحذف كل ما بها إضافة التالي
/ip firewall mangle
add action=mark-connection chain=input disabled=no in-interface=WAN1 new-connection-mark=WAN1_conn passthrough=yes hotspot=auth hotspot=auth
add action=mark-connection chain=input disabled=no in-interface=WAN2 new-connection-mark=WAN2_conn passthrough=yes hotspot=auth
add action=mark-connection chain=input disabled=no in-interface=WAN3 new-connection-mark=WAN3_conn passthrough=yes hotspot=auth
add action=mark-routing chain=output connection-mark=WAN1_conn disabled=no new-routing-mark=to_WAN1 passthrough=yes hotspot=auth
add action=mark-routing chain=output connection-mark=WAN2_conn disabled=no new-routing-mark=to_WAN2 passthrough=yes hotspot=auth
add action=mark-routing chain=output connection-mark=WAN3_conn disabled=no new-routing-mark=to_WAN3 passthrough=yes hotspot=auth
add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=WAN1_conn passthrough=yes hotspot=auth per-connection-classifier=both-addresses-and-ports:3/0
add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=WAN2_conn passthrough=yes hotspot=auth per-connection-classifier=both-addresses-and-ports:3/1
add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=LAN new-connection-mark=WAN3_conn passthrough=yes hotspot=auth per-connection-classifier=both-addresses-and-ports:3/2
add action=mark-routing chain=prerouting connection-mark=WAN1_conn disabled=no in-interface=LAN new-routing-mark=to_WAN1 passthrough=yes hotspot=auth
add action=mark-routing chain=prerouting connection-mark=WAN2_conn disabled=no in-interface=LAN new-routing-mark=to_WAN2 passthrough=yes hotspot=auth
add action=mark-routing chain=prerouting connection-mark=WAN3_conn disabled=no in-interface=LAN new-routing-mark=to_WAN3 passthrough=yes hotspot=auth
ثم نقوم بالضغط على زر Enter
وإضافة هذا الكود للجزء رقم أربعة
/ip firewall nat add action=accept chain=pre-hotspot disabled=no dst-address-type=!local hotspot=auth
ثم نقوم بالضغط على زر Enter
وبهذا نكون قد انتهينا من أعداد الدمج