You are on page 1of 4

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=pppoe-viettel \
new-connection-mark=ether1-VIETTEL passthrough=yes
add action=mark-connection chain=input disabled=no in-interface=pppoe-vnpt \
new-connection-mark=ether2-VNPT passthrough=yes
add action=mark-routing chain=output connection-mark=ether1-VIETTEL disabled=no \
new-routing-mark=ether1-VIETTEL passthrough=yes
add action=mark-routing chain=output connection-mark=ether2-VNPT disabled=no \
new-routing-mark=ether2-VNPT passthrough=yes
add action=accept chain=prerouting disabled=no dst-address=192.168.0.0/21 \
in-interface=bridge1
add action=mark-connection chain=prerouting disabled=no dst-address-type=\
!local in-interface=bridge1 new-connection-mark=ether1-VIETTEL 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=bridge1 new-connection-mark=ether2-VNPT passthrough=yes \
per-connection-classifier=both-addresses-and-ports:1/1
add action=mark-routing chain=prerouting connection-mark=ether1-VIETTEL disabled=no
\
in-interface=bridge1 new-routing-mark=ether1-VIETTEL passthrough=yes
add action=mark-routing chain=prerouting connection-mark=ether2-VNPT disabled=no \
in-interface=bridge1 new-routing-mark=ether2-VNPT passthrough=yes

/ip firewall nat


add action=masquerade chain=srcnat disabled=no out-interface=pppoe-viettel
add action=masquerade chain=srcnat disabled=no out-interface=pppoe-vnpt

/ip route
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\
pppoe-viettel routing-mark=ether1-VIETTEL scope=30 target-scope=10
add check-gateway=ping disabled=no distance=2 dst-address=0.0.0.0/0 gateway=\
pppoe-vnpt routing-mark=ether2-VNPT scope=30 target-scope=10

You might also like