Home / Bài Viết / Các Kiểu Load Balancing Mikrotik

Các Kiểu Load Balancing Mikrotik


– Kiểu 1 : Chỉ cân bằng tải, không gộp băng thông


/ip firewall mangle


add action=mark-connection chain=input disabled=no in-interface=vnpt1 \
new-connection-mark=to_vnpt1 passthrough=yes
add action=mark-connection chain=input disabled=no in-interface=vnpt2 \
new-connection-mark=to_vnpt2 passthrough=yes



add action=mark-connection chain=prerouting connection-mark=no-mark disabled=\
no in-interface=vnpt1 new-connection-mark=to_vnpt1 passthrough=yes
add action=mark-connection chain=prerouting connection-mark=no-mark disabled=\
no in-interface=vnpt2 new-connection-mark=to_vnpt2 passthrough=yes


add action=mark-connection chain=prerouting connection-mark=no-mark disabled=\
no dst-address-type=!local in-interface=LAN new-connection-mark=\
to_vnpt1 passthrough=yes per-connection-classifier=both-addresses:2/0
add action=mark-connection chain=prerouting connection-mark=no-mark disabled=\
no dst-address-type=!local in-interface=LAN new-connection-mark=\
to_vnpt2 passthrough=yes per-connection-classifier=both-addresses:2/1


add action=mark-routing chain=prerouting connection-mark=to_vnpt1 disabled=\
no in-interface=LAN new-routing-mark=to_vnpt1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=vnpt6_conn disabled=\
no in-interface=LAN new-routing-mark=to_vnpt6 passthrough=yes


add action=mark-routing chain=output connection-mark=to_vnpt1 disabled=no \
new-routing-mark=to_vnpt1 passthrough=yes
add action=mark-routing chain=output connection-mark=to_vnpt2 disabled=no \
new-routing-mark=to_vnpt2 passthrough=yes


/ip firewall nat
add action=masquerade chain=srcnat disabled=no out-interface=vnpt1
add action=masquerade chain=srcnat disabled=no out-interface=vnpt2


/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
vnpt1 routing-mark=to_vnpt1 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
vnpt2 routing-mark=to_vnpt2 scope=30 target-scope=10

 


Kiểu 2 : Cân Bằng tải, Gộp băng thông download

/ip firewall mangle
add action=mark-connection chain=prerouting disabled=no in-interface=Lan_eth \
new-connection-mark=to_vnpt1 passthrough=yes
add action=mark-connection chain=prerouting disabled=no in-interface=Lan_eth \
new-connection-mark=to_vnpt2 passthrough=yes


add action=mark-routing chain=prerouting disabled=no in-interface=Lan_eth \
new-routing-mark=to_vnpt1 passthrough=yes src-address-list=to_vnpt1
add action=mark-routing chain=prerouting disabled=no in-interface=Lan_eth \
new-routing-mark=to_vnpt2 passthrough=yes src-address-list=to_vnpt2


add action=mark-connection chain=prerouting connection-state=new disabled=no \
in-interface=Lan_eth new-connection-mark=to_vnpt1 nth=2,1 passthrough=yes
add action=mark-connection chain=prerouting connection-state=new disabled=no \
in-interface=Lan_eth new-connection-mark=to_vnpt2 nth=2,2 passthrough=yes


add action=add-src-to-address-list address-list=to_vnpt1 address-list-timeout=\
1d chain=prerouting connection-mark=to_vnpt1 disabled=no in-interface=\
Lan_eth
add action=add-src-to-address-list address-list=to_vnpt2 address-list-timeout=\
1d chain=prerouting connection-mark=to_vnpt2 disabled=no in-interface=\
Lan_eth


add action=mark-routing chain=prerouting connection-mark=to_vnpt1 disabled=no \
in-interface=Lan_eth new-routing-mark=to_vnpt1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=to_vnpt2 disabled=no \
in-interface=Lan_eth new-routing-mark=to_vnpt2 passthrough=yes


/ip firewall nat
add action=masquerade chain=srcnat disabled=no out-interface=vnpt1
add action=masquerade chain=srcnat disabled=no out-interface=vnpt2


/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
vnpt1 routing-mark=to_vnpt1 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
vnpt2 routing-mark=to_vnpt2 scope=30 target-scope=10


Kiểu 3 : Cân bằng tải, Gộp băng thông download và upload

/ip firewall mangle
add action=mark-connection chain=input disabled=no in-interface=vnpt1 \
new-connection-mark=to_vnpt1 passthrough=yes
add action=mark-connection chain=input disabled=no in-interface=vnpt2 \
new-connection-mark=to_vnpt2 passthrough=yes
add action=mark-routing chain=output connection-mark=to_vnpt1 disabled=no \
new-routing-mark=to_vnpt1 passthrough=yes
add action=mark-routing chain=output connection-mark=to_vnpt2 disabled=no \
new-routing-mark=to_vnpt2 passthrough=yes
add action=accept chain=prerouting disabled=no dst-address=192.168.0.0/24 \
in-interface=Lan_eth
add action=mark-connection chain=prerouting disabled=no dst-address-type=\
!local in-interface=Lan_eth new-connection-mark=to_vnpt1 passthrough=yes \
per-connection-classifier=both-addresses-and-ports:2/0
add action=mark-connection chain=prerouting disabled=no dst-address-type=\
!local in-interface=Lan_eth new-connection-mark=to_vnpt2 passthrough=yes \
per-connection-classifier=both-addresses-and-ports:1/1
add action=mark-routing chain=prerouting connection-mark=to_vnpt1 disabled=no \
in-interface=Lan_eth new-routing-mark=to_vnpt1 passthrough=yes
add action=mark-routing chain=prerouting connection-mark=to_vnpt2 disabled=no \
in-interface=Lan_eth new-routing-mark=to_vnpt2 passthrough=yes


/ip firewall nat
add action=masquerade chain=srcnat disabled=no out-interface=vnpt1
add action=masquerade chain=srcnat disabled=no out-interface=vnpt2


/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
vnpt1 routing-mark=to_vnpt1 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=2 dst-address=0.0.0.0/0 gateway=\
vnpt2 routing-mark=to_vnpt2 scope=30 target-scope=10

About vongabau

Kiểm Tra

Máy Tính Làm Modem PC Router Sử Dụng Router OS

Hướng dẫn Cài đặt bootrom, game server NxD, PC Modem Mikrotik, ikuai8, pfsense … Khắc …

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

0939150222