网吧用ros最正确的限速

上传人:kms****20 文档编号:37353850 上传时间:2018-04-15 格式:DOC 页数:14 大小:82.50KB
返回 下载 相关 举报
网吧用ros最正确的限速_第1页
第1页 / 共14页
网吧用ros最正确的限速_第2页
第2页 / 共14页
网吧用ros最正确的限速_第3页
第3页 / 共14页
网吧用ros最正确的限速_第4页
第4页 / 共14页
网吧用ros最正确的限速_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《网吧用ros最正确的限速》由会员分享,可在线阅读,更多相关《网吧用ros最正确的限速(14页珍藏版)》请在金锄头文库上搜索。

1、网吧用 ROS 最正确的限速一直以来,都看论坛上的达人说 ROS 做软路由器效果是多么的强大,于是偶也搞一个试试 看。找了一个 2.9.27 的完全破解版,用了 2 块 D-LINK530 的网卡,装完一用还真行。比我 那 1000 的锐捷强多了,网吧 120 台机器,座满的时候那个锐捷的路由器登陆界面都打不开。 用上以后问题就来了,我们 30M 的光纤,如果不限速,那些下载狂人把带宽全部给占用了, 打游戏的顾客很有意见。于是我就做了个限速,每个机器下载最大 2M.平均 1M。但是群众 还是不满意,都所卡。我又找资料,发现原来还有个叫智能动态限速的东西,好偶照做。 做好以后,平时喊卡的人没有了

2、,人多的时候一样都喊卡。偶傻眼了,难道只能不限速。还好天无绝人之路,还有个“小包优先”的高级货,于是照 做。结果用简单队列限速后, “小包优先”也是白搭,难道天要忘我。终于经过 N 次测试 以后,我明白了。网吧用简单队列做限速完全是扯蛋。网吧限速最好的办法应该是带宽均 分,然后在用简单队列来限制上传。在利用小包优先来处理游戏卡的问题。经过 2 个网吧, 一个月的测试,完全摆脱了到处喊卡的噩梦,现在把经验发来大家分享一下。ROS 不要用简单队列来限速,什么智能动态限速也不要用。只需要用小包优先+带宽均分+ 简单队列限制上传速度。小包优先的脚本如下:ip firewall mangle add c

3、hain=forward p2p=all-p2p action=mark-connection new-connection-mark=p2p_conn passthrough=yes comment=“ disabled=no add chain=forward connection-mark=p2p_conn action=mark-packet new-packet-mark=p2p passthrough=yes comment=“ disabled=no add chain=forward connection-mark=!p2p_conn action=mark-packet ne

4、w-packet- mark=general passthrough=yes comment=“ disabled=no add chain=forward packet-size=32-512 action=mark-packet new-packet-mark=small passthrough=yes comment=“ disabled=no add chain=forward packet-size=512-1200 action=mark-packet new-packet-mark=big passthrough=yes comment=“ disabled=no/ queue

5、tree add name=“p2p1“ parent=wan packet-mark=p2p limit-at=2000000 queue=default priority=8 max-limit=6000000 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no add name=“p2p2“ parent=lan packet-mark=p2p limit-at=2000000 queue=default priority=8 max-limit=6000000 burst-limit=0 burst-threshold=0

6、 burst-time=0s disabled=no add name=“ClassA“ parent=lan packet-mark=“ limit-at=0 queue=default priority=8 max- limit=100000000 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no add name=“ClassB“ parent=ClassA packet-mark=“ limit-at=0 queue=default priority=8 max- limit=0 burst-limit=0 burst-

7、threshold=0 burst-time=0s disabled=no add name=“Leaf1“ parent=ClassA packet-mark=general limit-at=0 queue=default priority=7 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no add name=“Leaf2“ parent=ClassB packet-mark=small limit-at=0 queue=default priority=5 max-limit=0 burst-li

8、mit=0 burst-threshold=0 burst-time=0s disabled=no add name=“Leaf3“ parent=ClassB packet-mark=big limit-at=0 queue=default priority=6 max- limit=0 burst-limit=0 burst-threshold=0 burst-time=0s disabled=no然后是带宽均分:/ip firewall mangle add chain=forward src-address=192.168.0.0/24 action=mark-connection n

9、ew-connection-mark=users-con /ip firewall mangle add connection-mark=users-con action=mark-packet new-packet-mark=users chain=forward/queue type add name=pcq-download kind=pcq pcq-classifier=dst-address /queue type add name=pcq-upload kind=pcq pcq-classifier=src-address/queue tree add name=Download

10、parent=lan max-limit=30M /queue tree add parent=Download queue=pcq-download packet-mark=users/queue tree add name=Upload parent=wan max-limit=28M/queue tree add parent=Upload queue=pcq-upload packet-mark=users请根据直接实际修改 IP 地址段,下载最大速度,上传最大速度,lan 为我连接内网的网卡, wan 是我连接外网的网卡限制上传速度的脚本::for aaa from 2 to 180

11、 do=/queue simple add name=(PC . $aaa) dst-address=(192.168.0. . $aaa) limit-at=10000000/3000000 max-limit=30000000/3000000如果是 3.2 版本的,这个脚本自己要修改下,就用这 3 个部分,别的不需要的,绝对比什么智能动态限速好的多。+ + -RouterOS 技术集粹 日志:节省磁盘资源!:foreach i in=/system logging facility find local=memory do=/system logging facility set $i l

12、ocal=noneRO 防 synip-firewall-connections Tracking:TCP Syn Sent Timeout:50TCP syn received timeout:30限线程脚本: :for aaa from 2 to 254 do=/ip firewall filter add chain=forward src-address=(192.168.0. . $aaa) protocol=tcp connection-limit=50,32 action=drop RO 端口的屏蔽ip-firewall-Filer Rules 里面选择 forward 的意思代

13、表包的转发 firewall rule-GeneralDst.Address:要屏蔽的端口Protocol:tcp Action:drop(丢弃)ros 限速手动限速winbox-queues-simple queues点“+” ,NAME 里随便填,下面是 IP 地址的确定Target Address 不管,Dst. Address 里填 你要限制的内网机器的 IP,比如我这里有个 1 号机器 IP 为 192.168.1.101,那 dst.address 里就填 192.168.1.101 然后是/32(这里的 32 不是指掩码了,个人理解为指定的意思)!interface 里 记着要选

14、你连接外网那个卡,我这里分了“local 和 public” ,所以选 public 其他的不管,我们来看最重要的东西拉,Max limit ,这个东西是你限制的上限,注意 的是 这里的数值是比特位,比如我要限制 下载的速度为 500K 那么就填入多少呢? 500 X 1000 X 8=400 0000=4M。 另外,很多朋友都有个疑问,到底一般的用户会有多大流量呢?一般的网络游戏,如 梦幻西游 传奇 封神榜 等等,其下行在 20Kbps 以内! 最耗网络资源的就是下载-我们 就是为了限制它拉,其次是 VOD 点播,一般 DVD 格式的大约要 2M 多吧,所以你看情况 限制拉 别搞的太绝!限速

15、脚本: :for aaa from 2 to 254 do=/queue simple add name=(queue . $aaa) dst-address=(192.168.0. . $aaa) limit-at=0/0 max-limit=2000000/2000000 说明: aaa 是变量 2 to 254 是 2254 192.168.0. . $aaa 是 IP 上两句加起来是 192.168.0.2192.168.0.254 connection-limit=50 是线程数这里为 50 max-limit=2000000/2000000 是上行下行 使用: WinBox-System-Scripts- Name(脚本名程) Source(脚本) OK-选择要运行的脚本-Run Script ROS 限速的极致应用一般我们用 ros 限速只是使用了 max-limit,其实 ros 限速可以更好的运用。比如我们希望 客户打开网页时速度可以快一些,下载时速度可以慢一些。ros2.9 就可以实现。max-limit-我们最常用的地方,最大速度 burst-

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号