鸿蒙 ros,ROS多线路负载均衡

本次列出使用PCC负载均衡实例

网上看到过教程,感觉脚本来的快点,下面就是PCC4个ADSL的负载均衡的脚本:

/ip firewall address-list

add address=192.168.88.0/24 disabled=no list=local

/ip firewall mangle

add action=mark-connection chain=input disabled=no in-interface=pppoe-out1 \

new-connection-mark=pppoe-out1 passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out2 \

new-connection-mark=pppoe-out2 passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out3 \

new-connection-mark=pppoe-out3 passthrough=yes

add action=mark-connection chain=input disabled=no in-interface=pppoe-out4 \

new-connection-mark=pppoe-out4 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out1 disabled=no \

new-routing-mark=to_pppoe-out1 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out2 disabled=no \

new-routing-mark=to_pppoe-out2 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out3 disabled=no \

new-routing-mark=to_pppoe-out3 passthrough=yes

add action=mark-routing chain=output connection-mark=pppoe-out4 disabled=no \

new-routing-mark=to_pppoe-out4 passthrough=yes

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out1 \

passthrough=yes per-connection-classifier=both-addresses:4/0 \

src-address-list=local

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out2 \

passthrough=yes per-connection-classifier=both-addresses:4/1 \

src-address-list=local

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out3 \

passthrough=yes per-connection-classifier=both-addresses:4/2\

src-address-list=local

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out4 \

passthrough=yes per-connection-classifier=both-addresses:4/3 \

src-address-list=local

add action=mark-routing chain=prerouting connection-mark=pppoe-out1 disabled=\

no new-routing-mark=to_pppoe-out1 passthrough=no src-address-list=local

add action=mark-routing chain=prerouting connection-mark=pppoe-out2 disabled=\

no new-routing-mark=to_pppoe-out2 passthrough=no src-address-list=local

add action=mark-routing chain=prerouting connection-mark=pppoe-out3 disabled=\

no new-routing-mark=to_pppoe-out3 passthrough=no src-address-list=local

add action=mark-routing chain=prerouting connection-mark=pppoe-out4 disabled=\

no new-routing-mark=to_pppoe-out4 passthrough=no src-address-list=local

/ip route

add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\

pppoe-out1 routing-mark=to_pppoe-out1 scope=30 target-scope=10

add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\

pppoe-out2 routing-mark=to_pppoe-out2 scope=30 target-scope=10

add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\

pppoe-out3 routing-mark=to_pppoe-out3 scope=30 target-scope=10

add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\

pppoe-out4 routing-mark=to_pppoe-out4 scope=30 target-scope=10

add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\

pppoe-out1 scope=30 target-scope=10

add check-gateway=ping disabled=no distance=2 dst-address=0.0.0.0/0 gateway=\

pppoe-out2 scope=30 target-scope=10

add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=\

pppoe-out3 scope=30 target-scope=10

add check-gateway=ping disabled=no distance=2 dst-address=0.0.0.0/0 gateway=\

pppoe-out4 scope=30 target-scope=10

进入winbox ->NewTerminal ,在控制台paste以上脚本即可。

如果是固定4个IP的,可以将pppoe-out(1-4)改成ethernet(1-4),如果只有2个ADSL(或固定IP),代码中的

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out1 \

passthrough=yes per-connection-classifier=both-addresses:4/0 \

src-address-list=local

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out2 \

passthrough=yes per-connection-classifier=both-addresses:4/1 \

src-address-list=local

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out3 \

passthrough=yes per-connection-classifier=both-addresses:4/2\

src-address-list=local

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out4 \

passthrough=yes per-connection-classifier=both-addresses:4/3 \

src-address-list=local

要改成

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out1 \

passthrough=yes per-connection-classifier=both-addresses:2/0 \

src-address-list=local

add action=mark-connection chain=prerouting disabled=no dst-address-list=\

!local dst-address-type=!local new-connection-mark=pppoe-out2 \

passthrough=yes per-connection-classifier=both-addresses:2/1 \

src-address-list=local 。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值