PDA

View Full Version : Các Kiểu Cân Bằng Tải Của Mikrotik



trangtrau
22-04-2016, 10:47 AM
Sau mồi hồi mầy mò, mình tìm được 3 kiểu cân bằng tải đơn giản nhất cho mikrotik. Chia sẻ cho anh em là phụ, mà lưu vào để bản thân dùng là chính :D


- 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

phi.thuong
22-04-2016, 01:05 PM
chơi bằng dòng lệnh hãi não quá :D

doanitvn
23-04-2016, 08:30 PM
[Only registered and activated users can see links]
- tiger 1 1 gộp
- tiger 1 2 là ưu tiên line 2
- tiger 2 1 là ưu tiên line 1

thaiduongfo
24-04-2016, 09:43 AM
chơi bằng dòng lệnh hãi não quá :D
heheh microtik là thế mà

Skylake
24-04-2016, 11:24 AM
Export nó ra vậy, chứ thực sự toàn dùng gui winbox

quangduylc
16-08-2016, 01:03 PM
Có bác nào rảnh, teamview giúp em config cộng băng thông được ko?

thaiduongfo
16-08-2016, 01:27 PM
Có bác nào rảnh, teamview giúp em config cộng băng thông được ko?
he he..đopnư vị nào cung cấp hàng cho bạn ấy..vui lòng teamview hỗ trợ đi kìa.....còn nếu bạn ý tiếc tiền tự ..."build" thì...hỏi bác google.....nhé...vì bác google hẻm có en cơm!!!!

quangduylc
16-08-2016, 02:28 PM
ak chỗ mình làm, họ mua của Viettuans nhưng mà support thì ko đc tốt, nên mình cần sự giúp đỡ của các bác

Skylake
16-08-2016, 02:54 PM
Có bác nào rảnh, teamview giúp em config cộng băng thông được ko?

Teamview mà apply rule loadblancing là nó rớt mạng ngay, làm sao mà cài từ xa đc.
Bạn chịu khó xem hướng dẫn, nếu chỗ nào không hiểu thì mọi người sẽ giúp.

vongabau
16-08-2016, 09:54 PM
ak chỗ mình làm, họ mua của Viettuans nhưng mà support thì ko đc tốt, nên mình cần sự giúp đỡ của các bác
yahoo hoặc zalo hoặc facebook nhé mình team dùm cho

phamvanlinh2011vn
22-11-2016, 03:50 PM
a vongabau có ip sever game liên minh + fifa ko bán cho e với ( hoặc port 2 game đó cũng đc ) e pm cả forum ko ai giúp :D

phonght3
08-12-2016, 08:41 PM
Em cám ơn anh Vongabau đã teamview giúp em cấu hình Load balancing nhiều! :D

duy.tq1981
29-12-2016, 08:22 AM
cảm ơn bác trangtrau em đã lèm được

duy.tq1981
29-12-2016, 10:04 PM
trong 3 kiểu theo các bác nên dùng kiểu nào được

quangduylc
30-12-2016, 03:34 PM
trong 3 kiểu theo các bác nên dùng kiểu nào được
Theo mình bạn nên sử dụng Kiểu 2 : Cân Bằng tải, Gộp băng thông download
Tăng tốc download, còn upload thì không hiệu quả vs những trg hợp NAT camera đa phần không xem đc từ bên ngoài, và upload file kê khai thuế sẽ báo lỗi.

Scarecrow
24-09-2017, 07:35 AM
Bác ơi em thấy là bác cân 2 WAN đi ra 1 LAN. Vậy giờ em muốn cân 2 WAN đi ra nhiều LAN thì phải làm như nào hả bác. Mong bác chỉ giáo.

quangduylc
26-09-2017, 08:14 PM
Lan của bạn là Port lan hay IP Lan?
1.Port Lan thì bạn bridge các port vào thành 1 nhóm vd Bridge 1 = (lan1,lan2..)
2.IP Lan thì bạn phải tạo addres list ip.

vongabau
29-09-2017, 06:12 PM
Sau mồi hồi mầy mò, mình tìm được 3 kiểu cân bằng tải đơn giản nhất cho mikrotik. Chia sẻ cho anh em là phụ, mà lưu vào để bản thân dùng là chính :D


- 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





chuẩn

kimthanhtung
09-10-2017, 10:53 AM
e đang sài hàng hãng của mikrotik CCr1036 12G 4s, thấy nó cứ tù tù thế nào ý

futbandau
15-05-2018, 02:27 AM
yahoo hoặc zalo hoặc facebook nhé mình team dùm cho
bác vongabau làm đc không team giúp em với công cán thế nào em gửi