MikroTik Routers7做单线多拨负载均衡

peng RouterOS来源:七界传说评论599阅读模式

路由器版本

x86_64_7.9

创建pppoe

/interface pppoe-client add interface=wan user=* password=* add-default-route=no name=pppoe-out1 disabled=no
/interface pppoe-client add interface=wan user=* password=* add-default-route=no name=pppoe-out2 disabled=no
/interface pppoe-client add interface=wan user=* password=* add-default-route=no name=pppoe-out3 disabled=no

注:user宽带帐号  password宽带密码

创建路由标记tables

/routing table add name=PPPoE_Rout_1 fib
/routing table add name=PPPoE_Rout_2 fib
/routing table add name=PPPoE_Rout_3 fib

创建mangle

劫持TCP Mss

/ip firewall mangle add action=change-mss chain=forward comment="chang mss" new-mss=clamp-to-pmtu passthrough=yes protocol=tcp tcp-flags=syn out-interface=pppoe-out1 place-before=0
/ip firewall mangle add action=change-mss chain=output new-mss=clamp-to-pmtu passthrough=yes protocol=tcp tcp-flags=syn place-before=1

注:out-interface=pppoe-out1 可以不选择  这条7.0版本无用

源进

/ip firewall mangle add action=mark-connection chain=prerouting comment="In_source" connection-mark=no-mark in-interface=pppoe-out1 new-connection-mark=In_Conn_1 passthrough=yes
/ip firewall mangle add action=mark-connection chain=prerouting  connection-mark=no-mark in-interface=pppoe-out2 new-connection-mark=In_Conn_2 passthrough=yes
/ip firewall mangle add action=mark-connection chain=prerouting  connection-mark=no-mark in-interface=pppoe-out3 new-connection-mark=In_Conn_3 passthrough=yes

源出

/ip firewall mangle add action=mark-routing chain=output comment="Out_source" connection-mark=In_Conn_1 new-routing-mark=PPPoE_Rout_1 passthrough=yes
/ip firewall mangle add action=mark-routing chain=output  connection-mark=In_Conn_2 new-routing-mark=PPPoE_Rout_2 passthrough=yes
/ip firewall mangle add action=mark-routing chain=output  connection-mark=In_Conn_3 new-routing-mark=PPPoE_Rout_3 passthrough=yes

负载均衡

/ip firewall mangle add action=mark-connection chain=prerouting comment="Pcc_1" dst-address-type=!local in-interface=Bridge new-connection-mark=In_Conn_1 passthrough=yes per-connection-classifier=src-address-and-port:3/0
/ip firewall mangle add action=mark-routing chain=prerouting connection-mark=In_Conn_1 in-interface=Bridge new-routing-mark=PPPoE_Rout_1 passthrough=yes
/ip firewall mangle add action=mark-connection chain=prerouting comment="Pcc_2" dst-address-type=!local in-interface=Bridge new-connection-mark=In_Conn_2 passthrough=yes per-connection-classifier=src-address-and-port:3/1
/ip firewall mangle add action=mark-routing chain=prerouting connection-mark=In_Conn_2 in-interface=Bridge new-routing-mark=PPPoE_Rout_2 passthrough=yes
/ip firewall mangle add action=mark-connection chain=prerouting comment="Pcc_3" dst-address-type=!local in-interface=Bridge new-connection-mark=In_Conn_3 passthrough=yes per-connection-classifier=src-address-and-port:3/2
/ip firewall mangle add action=mark-routing chain=prerouting connection-mark=In_Conn_3 in-interface=Bridge new-routing-mark=PPPoE_Rout_3 passthrough=yes

创建伪装nat

/ip firewall nat add chain=srcnat out-interface=pppoe-out1 action=masquerade comment="Src_A" place-before=0
/ip firewall nat add chain=srcnat out-interface=pppoe-out2 action=masquerade comment="Src_B" place-before=1
/ip firewall nat add chain=srcnat out-interface=pppoe-out3 action=masquerade comment="Src_C" place-before=2

创建路由Route

/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 distance=1 routing-table=main
/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out1 distance=1 routing-table=PPPoE_Rout_1
/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out2 distance=2 routing-table=PPPoE_Rout_2
/ip route add dst-address=0.0.0.0/0 gateway=pppoe-out3 distance=3 routing-table=PPPoE_Rout_3

效果展示

MikroTik Routers7做单线多拨负载均衡

如上图:贵州移动300+500 上传和下载都有叠加

贵州移动vlan

1_TR069_R_VID_3950

2_VOIP_R_VID_3750

3_OTHER_B_VID_3850

4_INTERNET_B_VID_41

IGMP SNOOPING组播vlan 3851到3_OTHER_B_VID_3850

文章末尾固定信息

weinxin
我的微信
我的微信
微信扫一扫
peng
  • 版权声明 本文源自 七界传说peng 整理 发表于 2023年6月16日22:42:41
  • 转载请务必保留本文链接:https://www.ixmu.net/33.html
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证