找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 5428|回复: 7

[负载平衡] PCC 9线脚本

[复制链接]
发表于 2010-9-2 16:15:12 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
本人ros 3.30 9线PPPOE PCC负载中
QQ 69737095
欢迎大家来探讨

/ip address add address=192.168.0.1/255.255.255.0 interface=lan comment=lan
/ip dns set primary-dns=202.102.192.68 secondary-dns=202.102.199.68 allow-remote-requests=yes

/ip firewall mangle
add action=change-mss chain=forward comment="" disabled=no new-mss=1440 protocol=tcp tcp-flags=syn

add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out1 new-connection-mark=pppoe-out1_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out2 new-connection-mark=pppoe-out2_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out3 new-connection-mark=pppoe-out3_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out4 new-connection-mark=pppoe-out4_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out5 new-connection-mark=pppoe-out5_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out6 new-connection-mark=pppoe-out6_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out7 new-connection-mark=pppoe-out7_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out8 new-connection-mark=pppoe-out8_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out9 new-connection-mark=pppoe-out9_conn passthrough=yes

add action=mark-routing chain=output comment="" connection-mark=pppoe-out1_conn disabled=no new-routing-mark=to_pppoe-out1 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out2_conn disabled=no new-routing-mark=to_pppoe-out2 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out3_conn disabled=no new-routing-mark=to_pppoe-out3 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out4_conn disabled=no new-routing-mark=to_pppoe-out4 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out5_conn disabled=no new-routing-mark=to_pppoe-out5 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out6_conn disabled=no new-routing-mark=to_pppoe-out6 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out7_conn disabled=no new-routing-mark=to_pppoe-out7 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out8_conn disabled=no new-routing-mark=to_pppoe-out8 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out9_conn disabled=no new-routing-mark=to_pppoe-out9 passthrough=yes

add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=lan new-connection-mark=pppoe-out1_conn passthrough=yes per-connection-classifier=both-addresses:9/0 src-address=192.168.0.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=lan new-connection-mark=pppoe-out2_conn passthrough=yes per-connection-classifier=both-addresses:9/1 src-address=192.168.0.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=lan new-connection-mark=pppoe-out3_conn passthrough=yes per-connection-classifier=both-addresses:9/2 src-address=192.168.0.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=lan new-connection-mark=pppoe-out4_conn passthrough=yes per-connection-classifier=both-addresses:9/3 src-address=192.168.0.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=lan new-connection-mark=pppoe-out5_conn passthrough=yes per-connection-classifier=both-addresses:9/4 src-address=192.168.0.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=lan new-connection-mark=pppoe-out6_conn passthrough=yes per-connection-classifier=both-addresses:9/5 src-address=192.168.0.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=lan new-connection-mark=pppoe-out7_conn passthrough=yes per-connection-classifier=both-addresses:9/6 src-address=192.168.0.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=lan new-connection-mark=pppoe-out8_conn passthrough=yes per-connection-classifier=both-addresses:9/7 src-address=192.168.0.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=lan new-connection-mark=pppoe-out9_conn passthrough=yes per-connection-classifier=both-addresses:9/8 src-address=192.168.0.0/24

add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out1_conn disabled=no in-interface=lan new-routing-mark=to_pppoe-out1 passthrough=yes src-address=192.168.0.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out2_conn disabled=no in-interface=lan new-routing-mark=to_pppoe-out2 passthrough=yes src-address=192.168.0.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out3_conn disabled=no in-interface=lan new-routing-mark=to_pppoe-out3 passthrough=yes src-address=192.168.0.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out4_conn disabled=no in-interface=lan new-routing-mark=to_pppoe-out4 passthrough=yes src-address=192.168.0.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out5_conn disabled=no in-interface=lan new-routing-mark=to_pppoe-out5 passthrough=yes src-address=192.168.0.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out6_conn disabled=no in-interface=lan new-routing-mark=to_pppoe-out6 passthrough=yes src-address=192.168.0.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out7_conn disabled=no in-interface=lan new-routing-mark=to_pppoe-out7 passthrough=yes src-address=192.168.0.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out8_conn disabled=no in-interface=lan new-routing-mark=to_pppoe-out8 passthrough=yes src-address=192.168.0.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out9_conn disabled=no in-interface=lan new-routing-mark=to_pppoe-out9 passthrough=yes src-address=192.168.0.0/24

/ip route
add comment=1 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_pppoe-out1 check-gateway=ping
add comment=2 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out2 routing-mark=to_pppoe-out2 check-gateway=ping
add comment=3 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out3 routing-mark=to_pppoe-out3 check-gateway=ping
add comment=4 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out4 routing-mark=to_pppoe-out4 check-gateway=ping
add comment=5 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out5 routing-mark=to_pppoe-out5 check-gateway=ping
add comment=6 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out6 routing-mark=to_pppoe-out6 check-gateway=ping
add comment=7 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out7 routing-mark=to_pppoe-out7 check-gateway=ping
add comment=8 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out8 routing-mark=to_pppoe-out8 check-gateway=ping
add comment=9 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out9 routing-mark=to_pppoe-out9 check-gateway=ping

add check-gateway=ping comment="pppoe-out1" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out1
add check-gateway=ping comment="pppoe-out2" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out2
add check-gateway=ping comment="pppoe-out3" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out3
add check-gateway=ping comment="pppoe-out4" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out4
add check-gateway=ping comment="pppoe-out5" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out5
add check-gateway=ping comment="pppoe-out6" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out6
add check-gateway=ping comment="pppoe-out7" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out7
add check-gateway=ping comment="pppoe-out8" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out8
add check-gateway=ping comment="pppoe-out9" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out9

/ip firewall nat
add action=masquerade chain=srcnat comment="1" disabled=no out-interface=pppoe-out1
add action=masquerade chain=srcnat comment="2" disabled=no out-interface=pppoe-out2
add action=masquerade chain=srcnat comment="3" disabled=no out-interface=pppoe-out3
add action=masquerade chain=srcnat comment="4" disabled=no out-interface=pppoe-out4
add action=masquerade chain=srcnat comment="5" disabled=no out-interface=pppoe-out5
add action=masquerade chain=srcnat comment="6" disabled=no out-interface=pppoe-out6
add action=masquerade chain=srcnat comment="7" disabled=no out-interface=pppoe-out7
add action=masquerade chain=srcnat comment="8" disabled=no out-interface=pppoe-out8
add action=masquerade chain=srcnat comment="9" disabled=no out-interface=pppoe-out9
routeros
发表于 2010-9-2 17:33:28 | 显示全部楼层
我汗,好长啊。。。
routeros
回复

使用道具 举报

发表于 2010-9-2 23:58:32 | 显示全部楼层
有这么多的吗?
routeros
回复

使用道具 举报

发表于 2010-9-3 00:01:49 | 显示全部楼层
确实 繁琐了些
routeros
回复

使用道具 举报

发表于 2010-9-3 08:37:45 | 显示全部楼层
很繁琐
routeros
回复

使用道具 举报

发表于 2010-9-7 09:08:34 | 显示全部楼层
routeros
回复

使用道具 举报

发表于 2010-9-7 11:17:06 | 显示全部楼层
是这样长吧
routeros
回复

使用道具 举报

发表于 2010-9-7 11:31:15 | 显示全部楼层
3线和9线有多大区别? 我记得早前发过 自动根据线路通断 动态调整的脚本。
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-18 04:31 , Processed in 0.096065 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表