通过routeros设置双ADSL负载平衡脚本

网络 路由交换
通过routeros设置双ADSL负载平衡脚本。

routeros双ADSL负载平衡脚本

[plain] # may/25/2013 09:26:48 by RouterOS 5.20

/ip firewall mangle add action=mark-connection chain=input disabled=no in-interface=pppoe-out1 new-connection-mark=wan1_conn passthrough=yes add action=mark-connection chain=input disabled=no in-interface=pppoe-out2 new-connection-mark=wan2_conn passthrough=yes add action=mark-routing chain=output connection-mark=wan1_conn disabled=no new-routing-mark=to_wan1 passthrough=yes add action=mark-routing chain=output connection-mark=wan2_conn disabled=no new-routing-mark=to_wan2 passthrough=yes add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=wan1 new-connection-mark=wan1_conn 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=wan1 new-connection-mark=wan2_conn passthrough=yes \ per-connection-classifier=both-addresses-and-ports:2/1 add action=mark-connection chain=prerouting disabled=no dst-address-type=!local in-interface=wan2 new-connection-mark=wan1_conn 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=wan2 new-connection-mark=wan2_conn passthrough=yes \ per-connection-classifier=both-addresses-and-ports:2/1 add action=mark-routing chain=prerouting connection-mark=wan1_conn disabled=no in-interface=wan1 new-routing-mark=to_wan1 passthrough=yes add action=mark-routing chain=prerouting connection-mark=wan2_conn disabled=no in-interface=wan1 new-routing-mark=to_wan2 passthrough=yes add action=mark-routing chain=prerouting connection-mark=wan1_conn disabled=no in-interface=wan2 new-routing-mark=to_wan1 passthrough=yes add action=mark-routing chain=prerouting connection-mark=wan2_conn disabled=no in-interface=wan2 new-routing-mark=to_wan2 passthrough=yes

/ip firewall nat add action=masquerade chain=srcnat disabled=no out-interface=pppoe-out1 add action=masquerade chain=srcnat disabled=no out-interface=pppoe-out2

/ip route add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_wan1 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_wan2 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

这个脚本是从老外Alex复制来的。

亲证好用,他原来是4线的。

可以往上加,修改2/0 2/1 为4/0 4/1 4/2 4/3网银也好用,并且下载带宽可以叠加。

interfaces里,拨号端是 wan1 wan2;接局域网是 lanPPPOE拨号是 pppoe-out1和pppoe-out2,使用这个默认名字比较好。

这几个符号改来改去,比较容易混淆。

网卡界面和拨号需要手动添加一下,主要是mangle和route两部分。

复制后,在new terminal里面粘贴就可以了。

责任编辑:遗忘者 来源: 中国IT实验室
相关推荐

2010-05-04 17:38:36

ISP负载平衡

2010-05-04 17:45:49

自动负载平衡

2010-05-04 17:31:05

2010-04-20 13:36:17

负载平衡

2010-05-05 18:07:53

网络负载平衡

2010-05-10 17:15:36

负载平衡方案

2010-12-17 10:45:13

ldirectordLVS负载平衡

2010-05-04 17:50:41

负载平衡

2010-04-21 13:48:48

网络负载平衡

2009-12-21 17:24:46

WCF负载平衡

2010-05-04 17:54:50

网络负载平衡

2013-12-16 15:09:15

多核负载

2010-02-22 16:43:09

WCF负载平衡

2010-05-10 18:27:51

负载平衡产品

2010-05-10 18:19:00

负载平衡技术

2010-04-25 23:36:47

负载平衡服务器

2022-02-06 11:50:29

HAProxy网络流量系统运维

2020-03-19 13:10:48

DRSVMware负载平衡

2023-12-15 19:29:20

2010-04-21 10:17:59

点赞
收藏

51CTO技术栈公众号