《ROS 典型PCC负载脚本》由会员分享,可在线阅读,更多相关《ROS 典型PCC负载脚本(9页珍藏版)》请在金锄头文库上搜索。
1、本文格式为Word版,下载可任意编辑ROS 典型PCC负载脚本 ROS 典型PCC负载脚本 :global num :set num 38 :for szwm from=1 to=$num do= :global type :set type ( . $num . . ($szwm-1) #设置网卡名字 name中的wlan可以改成 #/interface set ( . $szwm) #建立pppoe拨号,并禁用 /interface pppoe-client add name=( . $szwm) user=(wm) interface=( .$szwm) comment=( . $szw
2、m) disabled=no # NAT伪装 /ip firewall nat add chain=srcnat out-interface=( . $szwm) action=masquerade comment=( . $szwm) # 标记从哪里来 / ip firewall mangle add chain=input in-interface=( . $szwm) action=mark-connection new-connection-mark=(comment=( . $szwm) #标记从哪里来,回哪里去 / ip firewall mangle add chain=outp
3、ut connection-mark=( action=mark-routing new-routing-mark=( . $szwm) passthrough=yes comment=( . $szwm) #PCC设置 /ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark=( dst-address-type=!local in-interface=Local per-connection-classifier=$type passthrough=yes comment=( .
4、$szwm) #标记路由 /ip firewall mangle add chain=prerouting connection-mark=(action=mark-routing new-routing-mark=( . $szwm) comment=( . $szwm) #添加路由 /ip route add dst-address=0.0.0.0/0 gateway=( . $szwm) routing-mark=( . $szwm) check-gateway=ping comment=( . $szwm) add dst-address=0.0.0.0/0 gateway=( . $
5、szwm) distance=$szwm check-gateway=ping comment=( . $szwm) 合作这个掉线后自动修改脚本很好用 以4线为例,其中某条线路断了后,会自动判断剩余可用的线路数量然后修改PCC规矩的参数,线路恢复正常后会自动把参数修改回正常状态,留神连接标记名称确定要以纯数字“1、2、3、4.”来命名。一般该脚本设置30秒间隔就对比适合。 #pcc掉线后自动修改参数脚本 :local status :local i :local x :local y :local z :set x :len /interface pppoe-client find runni
6、ng=yes :if ($x0) do= :for ii from=1 to=$i do= /ip fi man set find new-connection-mark=$ii per-connection-classifier=( y ($y+1) 以上是PPPOE环境下的,下面的这个是固定IP一致网关的环境,2条线 /ip address add address=192.168.1.1/24 comment= disabled=no interface=lan network=192.168.1.0 add address=10.10.10.10/32 disabled=no inter
7、face=wan1 add address=20.20.20.20/32 disabled=no interface=wan2 /ip firewall mangle add action=accept chain=prerouting disabled=no dst-address=10.10.10.10 in-interface=wan1 add action=accept chain=prerouting disabled=no dst-address=20.20.20.20 in-interface=wan2 add action=mark-connection chain=input
8、 comment= disabled=no in-interface=wan1 new-connection-mark=wan1_conn passthrough=yes add action=mark-routing chain=output connection-mark=wan1_conn disabled=no new-routing-mark=wan1_rout passthrough=yes add action=mark-connection chain=input disabled=no in-interface=wan2 new-connection-mark=wan2_co
9、nn passthrough=yes add action=mark-routing chain=output connection-mark=wan2_conn disabled=no new-routing-mark=wan2_rout passthrough=yes add action=mark-connection chain=prerouting comment=wan1 disabled=no dst-address-type=!local new-connection-mark=wan1_conn passthrough=yes per-connection-classifie
10、r=both-addresses:2/0 src-address-list=192.168.1.0/24 add action=mark-routing chain=prerouting connection-mark=wan1_conn disabled= no new-routing-mark=wan1_rout passthrough=yes src-address-list=192.168.1.0/24 add action=mark-connection chain=prerouting comment=wan2 disabled=no dst-address-type=!local
11、 new-connection-mark=wan2_conn passthrough=yes per-connection-classifier=both-addresses:2/1 src-address-list=192.168.1.0/24 add action=mark-routing chain=prerouting connection-mark=wan2_conn disabled= no new-routing-mark=wan2_rout passthrough=yes src-address-list=192.168.1.0/24 add action=change-mss
12、 chain=forward comment= disabled=yes new-mss=1440 passthrough=yes protocol=tcp tcp-flags=syn /ip firewall nat add action=src-nat chain=srcnat comment= disabled=no out-interface=wan1 src-address-list=192.168.1.0/24 to-addresses=10.10.10.10 add action=src-nat chain=srcnat comment= disabled=no out-inte
13、rface=wan2 src-address-list=192.168.1.0/24 to-addresses=20.20.20.20 add action=masquerade chain=srcnat comment= disabled=no src-address-list=192.168.1.0/24 to-addresses=0.0.0.0 /ip route add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=1.1.1.1%wan1 routing-mark=wan1_rout scope=30 target-scop
14、e=10 add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=1.1.1.1%wan2 routing-mark=wan2_rout scope=30 target-scope=10 add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=1.1.1.1%wan1 scope=255 target-scope=10 add disabled=no distance=2 dst-address=0.0.0.0/0 gateway=1.1.1.1%wan2 scope=255 target-scope=10 add comment= disabled=yes distance=1 dst-address=0.0.0.0/0 gateway=192.168.1.1 scope=30 target-scope=10 这上5.x的双线同网关固定IP的pcc脚本 ,lan为局域网口,wan1和wan2为两个外网口。把1.1.1.1改成网关,10.10.10.1