方便懒人做PCC叠加的脚本
本帖最后由 FreeBSD_shell 于 2012-5-5 09:11 编辑#!/bin/sh
#This script is created by QQ:381722452
#Set vlan
:for i from=1 to=50 do= {/interface vlan add name=("VLAN".$i) vlan-id=$i interface=WAN}
#Set bridge
:for i from=1 to=50 do= {/interface bridge add name=("bridge".$i) auto-mac=no admin-mac=("AA:AB:AC:AD:AE:".($i+10))}
#Set bridge ports
:for i from=1 to=50 do= {/interface bridge port add interface=("VLAN".$i) bridge=("bridge".$i)}
#Set LAN PPPoE Server
:for i from=1 to=50 do= {
/interface pppoe-server server
add authentication=pap default-profile=default disabled=no interface=("VLAN".$i) service-name=("service")
}
#Set WAN PPPoE Client
:for i from=1 to=50 do= {
/interface pppoe-client
add name=("pppoe-out".$i) user=("user") password=("passwd") interface=("bridge".$i)
}
#Set Input Conn and Output Route
:for i from=1 to=50 do= {
/ip firewall mangle
add chain=input action=mark-connection new-connection-mark=("input".$i) in-interface=("pppoe-out".$i) comment=("Input".$i)
add chain=output connection-mark=("input".$i) action=mark-routing new-routing-mark=("route".$i)
}
#Set Pcc Conn and Route
:for i from=1 to=50 do= {
/ip firewall address-list add address=192.168.254.0/24 disabled=no list=mark_route
/ip firewall mangle
add chain=prerouting src-address-list=mark_route action=mark-connection comment=("Route".$i) \
new-connection-mark=("conn".$i) per-connection-classifier=("both-addresses-and-ports:50/".($i-1))
add chain=prerouting src-address-list=mark_route action=mark-routing new-routing-mark=("route".$i) connection-mark=("conn".$i)
}
#Set Mark Route
:for i from=1 to=50 do= {/ip route add dst-address=0.0.0.0/0 gateway=("pppoe-out".$i) routing-mark=("route".$i)}
#queue simple
:for i from=1 to=254 do= {
/queue simple add name=("queue".$i) target-addresses=("192.168.254.".$i) max-limit=256k/2M \
burst-limit=512k/3M burst-threshold=128k/1M burst-time=30s/30s
}
#Ros DDNS
> /tool dns-update name="www.baidu.com" address=127.0.0.255 key-name="user" key="passwd"
#NAT对外映射
> ip firewall nat add chain=dstnat action=dst-nat to-addresses=192.168.254.254 \
protocol=tcp in-interface=!LAN dst-port=80
#Set drop ping
#all
> /ip firewall filter add chain=output protocol=icmp action=drop
#LAN
> /ip firewall filter add chain=input action=drop protocol=icmp in-interface=LAN
#WAN
> /ip firewall filter add chain=input action=drop protocol=icmp in-interface=!LAN
#disabled bandwidth-serve
> /tool bandwidth-server set enabled=no
#disabled watchdog
> /system watchdog set automatic-supout=no
#disabled MAC winbox
> ip neighbor discovery set WAN
#Master VRRP
> /ip address add address=192.168.254.252/24 interface=LAN
> /interface vrrp add interface=LAN priority=255
> /ip address add address=192.168.254.254/24 interface=vrrp1
#Backup VRRP
> /ip address add address=192.168.254.253/24 interface=LAN
> /interface vrrp add interface=LAN
> /ip address add address=192.168.254.254/24 interface=vrrp1
限制每个主机TCP 连接数为80 条
> /ip firewall filter add chain=forward protocol=tcp connection-limit=80,32 action=drop
阻止不必要的 IP 广播:
> /ip firewall filter add chain=forward src-address=0.0.0.0/8 action=drop
> /ip firewall filter add chain=forward dst-address=0.0.0.0/8 action=drop
> /ip firewall filter add chain=forward src-address=127.0.0.0/8 action=drop
> /ip firewall filter add chain=forward dst-address=127.0.0.0/8 action=drop
> /ip firewall filter add chain=forward src-address=224.0.0.0/3 action=drop
> /ip firewall filter add chain=forward dst-address=224.0.0.0/3 action=drop
丢弃所有的P2P 协议
/ip firewall filter add chain=forward p2p=all-p2p action=drop 感谢分享。 感谢分享,对着想做10条ADSL以上的懒人来说,脚本简直是解救我们 :victory::victory: xhb912 发表于 2012-5-8 10:14 static/image/common/back.gif
感谢分享,对着想做10条ADSL以上的懒人来说,脚本简直是解救我们
我用来做4个交换机,每个交换机24条线,每条线4M进行叠加,使用起来非常方便 借问下楼主,比如10条ADSL,如果有的是12M 有的6M或者4M,,效果是不是比较差?ADSL每条线的流量一样是不是会比较好点? 看你负载分多少份,每根线跑多少份,如果这样的话你可以分成一份跑2M,也就是说4M的线跑2份,6M的跑3份,12M的跑6份,你可以这样试一下! xhb912 发表于 2012-5-8 12:34 static/image/common/back.gif
借问下楼主,比如10条ADSL,如果有的是12M 有的6M或者4M,,效果是不是比较差?ADSL每条线的流量一样是不是会比较 ...
看你负载分多少份,每根线跑多少份,如果这样的话你可以分成一份跑2M,也就是说4M的线跑2份,6M的跑3份,12M的跑6份,你可以这样试一下! 那PCC上面的设置应该是怎么设置的?比如我一条12M 一条6M 一条4M 一条2M..PPC时取值怎么取? :)是不是问题太复杂了? xhb912 发表于 2012-5-9 15:22 static/image/common/back.gif
是不是问题太复杂了?
不同带宽我负载均衡只能这样做了!不然负载不均衡 支持一下 不错,支持一下 没有vlan能否使用 不错的东西,赞一个
页:
[1]