routeros pcc 负载均衡资料(3.24及以上版本才支持)

以下是二线设置代码
说明:Local为内网 wlan1、wlan2为外网

/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
add address=10.111.0.2/24 network=10.111.0.0 broadcast=10.111.0.255 interface=wlan2
add address=10.112.0.2/24 network=10.112.0.0 broadcast=10.112.0.255 interface=wlan1

/ ip firewall mangle
add chain=input in-interface=wlan1 action=mark-connection new-connection-mark=wlan1_conn
add chain=input in-interface=wlan2 action=mark-connection new-connection-mark=wlan2_conn
add chain=output connection-mark=wlan1_conn action=mark-routing new-routing-mark=to_wlan1    
add chain=output connection-mark=wlan2_conn action=mark-routing new-routing-mark=to_wlan2    
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses:2/0
    action=mark-connection new-connection-mark=wlan1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses:2/1
    action=mark-connection new-connection-mark=wlan2_conn passthrough=yes
add chain=prerouting connection-mark=wlan1_conn in-interface=Local action=mark-routing new-routing-mark=to_wlan1
add chain=prerouting connection-mark=wlan2_conn in-interface=Local action=mark-routing new-routing-mark=to_wlan2

/ ip route
add dst-address=0.0.0.0/0 gateway=10.111.0.1 routing-mark=to_wlan1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.112.0.1 routing-mark=to_wlan2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.111.0.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.112.0.1 distance=2 check-gateway=ping

/ ip firewall nat
add chain=srcnat out-interface=wlan1 action=masquerade
add chain=srcnat out-interface=wlan2 action=masquerade

 

PCC双线负载均衡配置脚本

/ip firewall mangle
add action=change-mss chain=forward comment="" disabled=no new-mss=1400 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-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=prerouting comment="" connection-mark=pppoe-out1_conn disabled=no in-interface=LAN new-routing-mark=to_pppoe-out1 passthrough=yes
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

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:2/0
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:2/1

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
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

/ip route
add comment=adsl2 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=122.232.29.133 routing-mark=to_pppoe-out2 scope=30 target-scope=10
add comment=adsl1 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=122.232.17.225 routing-mark=to_pppoe-out1 scope=30 target-scope=10

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

如果你是ADSL动态IP和动态网关,请用动态脚本改变
:global assignaddress
:global newaddress
:global status
:global x
:global i
:set x 2
:for i from=1 to=$x do={
:set status [/interface get [/interface find  name=("pppoe-out" . $i)] running]
:if ($status=true) do={
:set newaddress [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address]
:set newaddress [:pick $newaddress 0 [:find $newaddress "/"]]
:set assignaddress [/ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]
:set assignaddress [:pick $assignaddress 0 [:find $assignaddress "/"]]
:if ($assignaddress != $newaddress) do={
/ip address set [/ip address find comment=("adsl" . $i)] address=$newaddress network=$newaddress broadcast=$newaddress
/ip route set [/ip route find comment=("adsl" . $i)] gateway=$newaddress
}
}
}

 

如果最下面的链接不能下载请点击微软的网盘链接

微软网盘链接

 


 

  • pcc.rar (351.5 KB)
  • 描述: 双线策略教程
  • 下载次数: 0
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值