作者hamdo (Hamdo)
看板Network
标题Re: [心得] 软路由的使用心得-RouterOS
时间Fri Sep 17 01:56:25 2010
逐行解释,不知道要写到什麽时候,我还是直接贴我的设定,有兴趣的再去找document对照着看,
一般HTB+PCQ只需靠in-interface来分别判断封包是由内而外还是由外而内
但不知道是不是我设定pppoe的方式导致mangle总抓不到全部由内而外(上传)的封包,导致queue tree也变得很怪,会被突破限制,
後来试出使用src-address来抓出上传封包,终於都抓到了,且连静态IP & DHCP都一并解决了。
我的网路环境是20m光纤,RouterOS的版本是4.10,需注意的是3.x版queue type及queue tree有其他的bug无法使用以下的设定
也许官方并没考虑到pppoe这种类似虚拟网卡的装置要如何被归类,总之他无法由对内的网卡截取到
/ip firewall mangle
chain=prerouting action=mark-packet new-packet-mark=first-priority-up passthrough=no dst-address=xxx.xxx.xxx.xxx
chain=prerouting action=mark-packet new-packet-mark=first-priority-down passthrough=no src-address=xxx.xxx.xxx.xxx
;;; Qos_SYN-up
chain=prerouting action=mark-packet new-packet-mark=first-priority-up passthrough=no tcp-flags=syn protocol=tcp src-address=192.168.0.0/16 packet-size=0-666
;;; Qos_ACK-up
chain=prerouting action=mark-packet new-packet-mark=first-priority-up passthrough=no tcp-flags=ack protocol=tcp src-address=192.168.0.0/16 packet-size=0-123
;;; p2p-up
chain=prerouting action=mark-packet new-packet-mark=p2p-up passthrough=no p2p=all-p2p src-address=192.168.0.0/16
;;; small_packet-up
chain=prerouting action=mark-packet new-packet-mark=small_packet-up passthrough=no p2p=!all-p2p src-address=192.168.0.0/16 packet-size=1-512
;;; big_packet-up
chain=prerouting action=mark-packet new-packet-mark=big_packet-up passthrough=no p2p=!all-p2p src-address=192.168.0.0/16 packet-size=512-1200
;;; general-up
chain=prerouting action=mark-packet new-packet-mark=general-up passthrough=no p2p=!all-p2p src-address=192.168.0.0/16
;;; Qos_SYN-down
chain=prerouting action=mark-packet new-packet-mark=first-priority-down passthrough=no tcp-flags=syn protocol=tcp in-interface=Hinet-Vdsl packet-size=0-666
;;; Qos_ACK-down
chain=prerouting action=mark-packet new-packet-mark=first-priority-down passthrough=no tcp-flags=ack protocol=tcp in-interface=Hinet-Vdsl packet-size=0-123
;;; ICMP
chain=prerouting action=mark-packet new-packet-mark=icmp_packet passthrough=no protocol=icmp
;;; p2p-down
chain=prerouting action=mark-packet new-packet-mark=p2p-down passthrough=no p2p=all-p2p in-interface=Hinet-Vdsl
;;; small_packet-down
chain=prerouting action=mark-packet new-packet-mark=small_packet-down passthrough=no p2p=!all-p2p in-interface=Hinet-Vdsl packet-size=1-512
;;; big_packet-down
chain=prerouting action=mark-packet new-packet-mark=big_packet-down passthrough=no p2p=!all-p2p in-interface=Hinet-Vdsl packet-size=512-1200
;;; general-down
chain=prerouting action=mark-packet new-packet-mark=general-down passthrough=no p2p=!all-p2p in-interface=Hinet-Vdsl
设定queue type,使用pcq作为伫列类型,pcq-rate对应到每个ip的最大速度
/queue type
name="Gen_download" kind=pcq pcq-rate=13000000 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=1000
name="Gen_upload" kind=pcq pcq-rate=400000 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=100
建立queue tree设定每个queue及sub-queue的优先权和该queue的最大频宽
/queue tree
name="Download" parent=global-in limit-at=0 priority=8 max-limit=19M burst-limit=0 burst-threshold=0 burst-time=0s
name="Upload" parent=global-in limit-at=0 priority=8 max-limit=1650k burst-limit=0 burst-threshold=0 burst-time=0s
name="p2p_download" parent=Download packet-mark=p2p-down limit-at=0 queue=Gen_download priority=8 max-limit=15M burst-limit=0 burst-threshold=0 burst-time=0s
name="p2p_upload" parent=Upload packet-mark=p2p-up limit-at=0 queue=Gen_upload priority=8 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
name="first_prioity-up" parent=Upload packet-mark=first-priority-up limit-at=32k queue=default priority=1 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
name="general_download" parent=Download packet-mark=general-down limit-at=0 queue=Gen_download priority=7 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s
name="small_upload" parent=Upload packet-mark=small_packet-up limit-at=0 queue=default priority=5 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s
name="big_upload" parent=Upload packet-mark=big_packet-up limit-at=0 queue=default priority=6 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s
name="small_download" parent=Download packet-mark=small_packet-down limit-at=0 queue=Gen_download priority=5 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s
name="big_download" parent=Download packet-mark=big_packet-down limit-at=0 queue=Gen_download priority=6 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s
name="first_prioity-down" parent=Download packet-mark=first-priority-down limit-at=32k queue=Gen_download priority=1 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
name="general-up" parent=Upload packet-mark=general-up limit-at=0 queue=Gen_upload priority=7 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
name="icmp_download" parent=global-out packet-mark=icmp_packet limit-at=32k queue=Gen_download priority=1 max-limit=2M burst-limit=0 burst-threshold=0 burst-time=0s
name="icmp_upload" parent=global-in packet-mark=icmp_packet limit-at=32k queue=default priority=1 max-limit=512k burst-limit=0 burst-threshold=0 burst-time=0s
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.116.219.48