Các cách cấu hình Loadbalance trên Mikrotik
Các cách cấu hình Loadbalance trên Mikrotik
* Vài lưu ý trước khi vào nội dung chính mình cần chia sẻ :
- 1. Bài viết này mang tính chất là dành cho cá nhân để lưu trữ kiến thức cũng như kinh nghiệm bản thân đã trải qua.
- 2. Bài viết chia sẻ phi lợi nhuân.
- 3. Bài viết có thể làm vài bạn sẽ biểu môi rằng đơn giản thế này ai chẳng biết, post lên làm gì ==> thì nhìn lại mục "1" nhé.
- 4. Bài viết có lấy hình ảnh và một vài nội dung trên internet, nên nếu có gì vi phạm, cảm phiền các bạn báo lại giúp mình
- Chỉ cân bằng tải:
Code
/ip firewall mangleadd action=mark-connection chain=input disabled=no in-interface=ISP1 \new-connection-mark=to_ISP1 passthrough=yesadd action=mark-connection chain=input disabled=no in-interface=ISP2 \new-connection-mark=to_ISP2 passthrough=yesadd action=mark-connection chain=prerouting connection-mark=no-mark disabled=\no in-interface=ISP1 new-connection-mark=to_ISP1 passthrough=yesadd action=mark-connection chain=prerouting connection-mark=no-mark disabled=\no in-interface=ISP2 new-connection-mark=to_ISP2 passthrough=yesadd action=mark-connection chain=prerouting connection-mark=no-mark disabled=\no dst-address-type=!local in-interface=LAN new-connection-mark=\to_ISP1 passthrough=yes per-connection-classifier=both-addresses:2/0add action=mark-connection chain=prerouting connection-mark=no-mark disabled=\no dst-address-type=!local in-interface=LAN new-connection-mark=\to_ISP2 passthrough=yes per-connection-classifier=both-addresses:2/1add action=mark-routing chain=prerouting connection-mark=to_ISP1 disabled=\no in-interface=LAN new-routing-mark=to_ISP1 passthrough=yesadd action=mark-routing chain=prerouting connection-mark=ISP2_conn disabled=\no in-interface=LAN new-routing-mark=to_ISP2 passthrough=yesadd action=mark-routing chain=output connection-mark=to_ISP1 disabled=no \new-routing-mark=to_ISP1 passthrough=yesadd action=mark-routing chain=output connection-mark=to_ISP2 disabled=no \new-routing-mark=to_ISP2 passthrough=yes/ip firewall natadd action=masquerade chain=srcnat disabled=no out-interface=ISP1add action=masquerade chain=srcnat disabled=no out-interface=ISP2/ip routeadd check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\ISP1 routing-mark=to_ISP1 scope=30 target-scope=10add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\ISP2 routing-mark=to_ISP2 scope=30 target-scope=10
- Cân bằng tải + gộp băng thông Download:
Code
/ip firewall mangleadd action=mark-connection chain=prerouting disabled=no in-interface=Lan_eth \new-connection-mark=to_ISP1 passthrough=yesadd action=mark-connection chain=prerouting disabled=no in-interface=Lan_eth \new-connection-mark=to_ISP2 passthrough=yesadd action=mark-routing chain=prerouting disabled=no in-interface=Lan_eth \new-routing-mark=to_ISP1 passthrough=yes src-address-list=to_ISP1add action=mark-routing chain=prerouting disabled=no in-interface=Lan_eth \new-routing-mark=to_ISP2 passthrough=yes src-address-list=to_ISP2add action=mark-connection chain=prerouting connection-state=new disabled=no \in-interface=Lan_eth new-connection-mark=to_ISP1 nth=2,1 passthrough=yesadd action=mark-connection chain=prerouting connection-state=new disabled=no \in-interface=Lan_eth new-connection-mark=to_ISP2 nth=2,2 passthrough=yesadd action=add-src-to-address-list address-list=to_ISP1 address-list-timeout=\1d chain=prerouting connection-mark=to_ISP1 disabled=no in-interface=\Lan_ethadd action=add-src-to-address-list address-list=to_ISP2 address-list-timeout=\1d chain=prerouting connection-mark=to_ISP2 disabled=no in-interface=\Lan_ethadd action=mark-routing chain=prerouting connection-mark=to_ISP1 disabled=no \in-interface=Lan_eth new-routing-mark=to_ISP1 passthrough=yesadd action=mark-routing chain=prerouting connection-mark=to_ISP2 disabled=no \in-interface=Lan_eth new-routing-mark=to_ISP2 passthrough=yes/ip firewall natadd action=masquerade chain=srcnat disabled=no out-interface=ISP1add action=masquerade chain=srcnat disabled=no out-interface=ISP2/ip routeadd check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\ISP1 routing-mark=to_ISP1 scope=30 target-scope=10add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\ISP2 routing-mark=to_ISP2 scope=30 target-scope=10
- Cân bằng tải + gộp băng thông cả Download và Upload:
Code
/ip firewall mangleadd action=mark-connection chain=input disabled=no in-interface=ISP1 \new-connection-mark=to_ISP1 passthrough=yesadd action=mark-connection chain=input disabled=no in-interface=ISP2 \new-connection-mark=to_ISP2 passthrough=yesadd action=mark-routing chain=output connection-mark=to_ISP1 disabled=no \new-routing-mark=to_ISP1 passthrough=yesadd action=mark-routing chain=output connection-mark=to_ISP2 disabled=no \new-routing-mark=to_ISP2 passthrough=yesadd action=accept chain=prerouting disabled=no dst-address=192.168.0.0/24 \in-interface=Lan_ethadd action=mark-connection chain=prerouting disabled=no dst-address-type=\!local in-interface=Lan_eth new-connection-mark=to_ISP1 passthrough=yes \per-connection-classifier=both-addresses-and-ports:2/0add action=mark-connection chain=prerouting disabled=no dst-address-type=\!local in-interface=Lan_eth new-connection-mark=to_ISP2 passthrough=yes \per-connection-classifier=both-addresses-and-ports:1/1add action=mark-routing chain=prerouting connection-mark=to_ISP1 disabled=no \in-interface=Lan_eth new-routing-mark=to_ISP1 passthrough=yesadd action=mark-routing chain=prerouting connection-mark=to_ISP2 disabled=no \in-interface=Lan_eth new-routing-mark=to_ISP2 passthrough=yes/ip firewall natadd action=masquerade chain=srcnat disabled=no out-interface=ISP1add action=masquerade chain=srcnat disabled=no out-interface=ISP2/ip routeadd check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\ISP1 routing-mark=to_ISP1 scope=30 target-scope=10add check-gateway=ping disabled=no distance=2 dst-address=0.0.0.0/0 gateway=\ISP2 routing-mark=to_ISP2 scope=30 target-scope=10
Đặt quảng cáo của bạn ở đây
Nhận xét
Đăng nhận xét