Originally Posted by
leniviy
ну во-первых 1:30 всегда будет на нуле, так как не заданы фильтры.
как вы запускаете?
wshaper start br0 5000 400
?
объяснить, что трафик торрента сначачала идет в 1:20, а потом в 1:30 не могу
Вот скрипт qos.sh запускаю /opt/etc/qos.sh start поскольку vlan1, 5000, 400 уже прописаны там...
Я пробовал запускать с br0, и сразу мерять - internet speed test падает дико....
А мне надо чтоб он урезал torrent (transmission) до 1:30 а VOIPб Port 80 и3389 до 1:10 а все остальное до 1:20... Как сделать не знаю...
В начале 1:10 -Sent 0 bytes 0 pkts
Code:
./qos.sh status
qdisc sfq 30: quantum 1518b perturb 10sec
statistics truncated
qdisc sfq 20: quantum 1518b perturb 10sec
statistics truncated
qdisc sfq 10: quantum 1518b perturb 10sec
statistics truncated
qdisc htb 1: r2q 10 default 20 direct_packets_stat 0
statistics truncated
class htb 1:1 root rate 700Kbit ceil 700Kbit burst 6Kb cburst 2495b
Sent 42 bytes 1 pkts (dropped 0, overlimits 0)
rate 1bps
lended: 0 borrowed: 0 giants: 0
tokens: 55808 ctokens: 22455
class htb 1:10 parent 1:1 leaf 10: prio 1 rate 240Kbit ceil 600Kbit burst 6Kb cburst 2367b
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 163840 ctokens: 25258
class htb 1:20 parent 1:1 leaf 20: prio 2 rate 240Kbit ceil 600Kbit burst 6Kb cburst 2367b
Sent 42 bytes 1 pkts (dropped 0, overlimits 0)
rate 1bps
lended: 1 borrowed: 0 giants: 0
tokens: 162774 ctokens: 24833
class htb 1:30 parent 1:1 leaf 30: prio 3 rate 120Kbit ceil 480Kbit burst 6Kb cburst 2213b
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 327680 ctokens: 29519
qdisc sfq 30: quantum 1518b perturb 10sec
statistics truncated
qdisc sfq 20: quantum 1518b perturb 10sec
statistics truncated
qdisc sfq 10: quantum 1518b perturb 10sec
statistics truncated
qdisc htb 1: r2q 10 default 20 direct_packets_stat 0
statistics truncated
class htb 1:1 root rate 700Kbit ceil 700Kbit burst 6Kb cburst 2495b
Sent 14314 bytes 91 pkts (dropped 0, overlimits 0)
rate 91bps
lended: 0 borrowed: 0 giants: 0
tokens: 55735 ctokens: 22382
class htb 1:10 parent 1:1 leaf 10: prio 1 rate 240Kbit ceil 600Kbit burst 6Kb cburst 2367b
Sent 3579 bytes 7 pkts (dropped 0, overlimits 0)
rate 15bps
lended: 7 borrowed: 0 giants: 0
tokens: 151894 ctokens: 20480
потом Sent 35832 bytes 71 pkts ''ползет'' постепенно вверх-
Code:
./qos.sh status
qdisc sfq 30: quantum 1518b perturb 10sec
statistics truncated
qdisc sfq 20: quantum 1518b perturb 10sec
statistics truncated
qdisc sfq 10: quantum 1518b perturb 10sec
statistics truncated
qdisc htb 1: r2q 10 default 20 direct_packets_stat 0
statistics truncated
class htb 1:1 root rate 700Kbit ceil 700Kbit burst 6Kb cburst 2495b
Sent 2747682 bytes 41998 pkts (dropped 0, overlimits 0)
rate 5608bps 102pps
lended: 53 borrowed: 0 giants: 0
tokens: 55369 ctokens: 22016
class htb 1:10 parent 1:1 leaf 10: prio 1 rate 240Kbit ceil 600Kbit burst 6Kb cburst 2367b
Sent 35832 bytes 71 pkts (dropped 0, overlimits 0)
rate 15bps
lended: 71 borrowed: 0 giants: 0
tokens: 151894 ctokens: 20480
class htb 1:20 parent 1:1 leaf 20: prio 2 rate 240Kbit ceil 600Kbit burst 6Kb cburst 2367b
Sent 2711850 bytes 41927 pkts (dropped 0, overlimits 0)
rate 5286bps 96pps
lended: 41874 borrowed: 53 giants: 0
tokens: 161494 ctokens: 24321
class htb 1:30 parent 1:1 leaf 30: prio 3 rate 120Kbit ceil 480Kbit burst 6Kb cburst 2213b
Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
lended: 0 borrowed: 0 giants: 0
tokens: 327680 ctokens: 29519
мой Qos.sh:
Code:
#!/bin/sh
# Wonder Shaper, last modified by Robert Koch (aka akbor)
#
# Set the following values to somewhat less than your actual download
# and uplink speed. In kilobits. Also set the device that is to be shaped.
DOWNLINK=5000
UPLINK=700
DEV=vlan1
# low priority OUTGOING traffic - you can leave this blank if you want
# low priority source netmasks
NOPRIOHOSTSRC="$5"
# low priority destination netmasks
NOPRIOHOSTDST="$6"
# low priority source ports
NOPRIOPORTSRC="$7"
# low priority destination ports
NOPRIOPORTDST="$8"
if [ "$1" = "status" ]
then
tc -s qdisc ls dev $DEV
tc -s class ls dev $DEV
exit
fi
# clean existing down- and uplink qdiscs, hide errors
tc qdisc del dev $DEV root 2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null
if [ "$1" = "stop" ]
then
exit
fi
########## uplink ##########
# install root HTB, point default traffic to 1:20:
tc qdisc add dev $DEV root handle 1: htb default 20
# shape everything at $UPLINK speed - this prevents huge queues in your
# DSL modem which destroy latency:
tc class add dev $DEV parent 1: classid 1:1 htb rate ${UPLINK}kbit \
ceil ${UPLINK}kbit burst 6k
# high prio class 1:10 - gets 40 to 100% traffic and highest priority:
# tc class add dev $DEV parent 1:1 classid 1:10 htb rate $((4*$UPLINK/10))kbit \
# ceil ${UPLINK}kbit burst 6k prio 1
tc class add dev $DEV parent 1:1 classid 1:10 htb rate 240kbit \
ceil 600kbit burst 6K prio 1
# bulk & default class 1:20 - gets 40 to 100% traffic and lower priority:
# tc class add dev $DEV parent 1:1 classid 1:20 htb rate $((4*$UPLINK/10))kbit \
# ceil ${UPLINK}kbit burst 6k prio 2
tc class add dev $DEV parent 1:1 classid 1:20 htb rate 240kbit \
ceil 600kbit burst 6k prio 2
# lowest priority class 1:30 - gets 20 to 80% traffic and lowest priority:
# tc class add dev $DEV parent 1:1 classid 1:30 htb rate $((2*$UPLINK/10))kbit \
# ceil $((8*$UPLINK/10))kbit burst 6k prio 3
tc class add dev $DEV parent 1:1 classid 1:30 htb rate 120kbit \
ceil 480kbit burst 6k prio 3
# all get Stochastic Fairness:
tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
# VOIP traffic always get first in line
tc filter add dev ${DEV} parent 1:0 prio 1 protocol ip u32 \
match ip tos 0x68 0xff \
match ip protocol 0x11 0xff \
flowid 1:10
tc filter add dev ${DEV} parent 1:0 prio 1 protocol ip u32 \
match ip tos 0xb8 0xff \
match ip protocol 0x11 0xff \
flowid 1:10
# Browsing traffic to and from port 80 get high priority
tc filter add dev $DEV parent 1: protocol ip prio 13 u32 \
match ip sport 80 0xffff \
flowid 1:10
# SSH traffic to and from port 22 get high priority
tc filter add dev $DEV parent 1: protocol ip prio 13 u32 \
match ip sport 22 0xffff \
flowid 1:10
# OPENVPN traffic to and from port 3389 get high priority
tc filter add dev $DEV parent 1: protocol ip prio 13 u32 \
match ip sport 3389 0xffff \
flowid 1:10
# All non-VoIP traffic on the second band
tc filter add dev ${DEV} parent 1:0 protocol ip prio 3 u32 \
match ip src 0.0.0.0/0 \
flowid 1:20
# TOS Minimum Delay
tc filter add dev ${DEV} parent 1:0 protocol ip prio 10 u32 \
match ip tos 0x10 0xff \
flowid 1:10
# ICMP (ip protocol 1) in the interactive class
tc filter add dev ${DEV} parent 1: protocol ip prio 11 u32 \
match ip protocol 1 0xff flowid 1:10
# To speed up downloads while an upload is going on, put ACK packets in
# the interactive class:
tc filter add dev ${DEV} parent 1: protocol ip prio 12 u32 \
match ip protocol 6 0xff \
match u8 0x05 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
match u8 0x10 0xff at 33 \
flowid 1:10
# some traffic however suffers a worse fate
# Browsing traffic to and from port 80 get high priority
tc filter add dev $DEV parent 1: protocol ip prio 1 u32 \
match ip sport 80 0xffff \
flowid 1:10
# SSH traffic to and from port 22 get high priority
tc filter add dev $DEV parent 1: protocol ip prio 2 u32 \
match ip sport 22 0xffff \
flowid 1:10
# Browsing traffic to and from port 3389 get high priority
tc filter add dev $DEV parent 1: protocol ip prio 3 u32 \
match ip sport 3389 0xffff \
flowid 1:10
for a in $NOPRIOPORTDST
do
tc filter add dev $DEV parent 1: protocol ip prio 30 u32 \
match ip protocol 0x6 0xff \
match ip dport $a 0xffff \
flowid 1:30
done
for a in $NOPRIOPORTSRC
do
tc filter add dev $DEV parent 1: protocol ip prio 31 u32 \
match ip protocol 0x6 0xff \
match ip sport $a 0xffff \
flowid 1:30
done
for a in $NOPRIOHOSTSRC
do
tc filter add dev $DEV parent 1: protocol ip prio 32 u32 \
match ip protocol 0x6 0xff \
match ip src $a \
flowid 1:30
done
for a in $NOPRIOHOSTDST
do
tc filter add dev $DEV parent 1: protocol ip prio 33 u32 \
match ip protocol 0x6 0xff \
match ip dst $a \
flowid 1:30
done
# rest is 'non-interactive' ie 'bulk' and ends up in the default queue
# tc filter add dev ${DEV} parent 1: protocol ip prio 20 u32 \
# match ip src 192.168.1.1/0 \
# flowid 1:30
########## dowlink #############
# slow downloads down to somewhat less than the real speed to prevent
# queuing at our ISP. Tune to see how high you can set it.
# ISPs tend to have *huge* queues to make sure big downloads are fast
#
# attach ingress policer:
if [ "$1" = "prio" ]
then
tc qdisc add dev $DEV handle ffff: ingress
# filter *everything* to it (0.0.0.0/0), drop everything that's
# coming in too fast:
tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 \
match ip protocol 0x6 0xff police rate ${DOWNLINK}kbit burst 10k drop \
flowid :1
fi