Well, I'm now tryin for 3 days to setup a correct QOS script on Kamikaze 7.09. The goal seem easy. I need to be sure to have at least 90kbit/s on port 9101, 9100, 5060 and 5061 on upload (these port are used for 2 shoutcast streams of 80kbit/s each). So, I first tried the qos-script package with this configuration :
# QoS configuration for OpenWrt
# INTERFACES:
config interface wan
option classgroup "Default"
option enabled 1
option overhead 1
option upload 240
option download 4096
# RULES:
config classify
option target "Bulk"
option ipp2p "all"
config classify
option target "Bulk"
option layer7 "edonkey"
config classify
option target "Bulk"
option layer7 "bittorrent"
config classify
option target "Priority"
option proto "tcp"
option ports "9100,9101,5060,5061"
option tos Minimize-Delay
config classify
option target "Priority"
option srcports "21,20,22,53,5055,5056"
config classify
option target "Up"
option proto "tcp"
option direction "out"
config default
option target "Express"
option proto "udp"
option pktsize "-500"
config reclassify
option target "Priority"
option proto "icmp"
config default
option target "Bulk"
option portrange "1024-65535"
config reclassify
option target "Priority"
option proto "tcp"
option pktsize "-128"
option mark "!Bulk"
option tcpflags "SYN"
config reclassify
option target "Priority"
option proto "tcp"
option pktsize "-128"
option mark "!Bulk"
option tcpflags "ACK"
config class "Priority"
option packetsize 400
option maxsize 400
option avgrate 90
option priority 15
config class "Priority_down"
option packetsize 1000
option avgrate 10
config class "Express"
option packetsize 1000
option maxsize 800
option avgrate 50
option priority 10
config class "Normal"
option packetsize 1500
option packetdelay 100
option avgrate 10
option priority 5
option limitrate 1024
config class "Normal_down"
option avgrate 20
config class "Up"
option maxsize 200
option limitrate 8
option priority 4
config class "Bulk"
option avgrate 1
option packetdelay 200
I have a vnc server on port 5040. When QOS is off, everything is good (but there is no limit on upload...), but, when it's on, the connection dropped everytime I connect the vnc server!
I also tried to do it manually so, I writed a tc setup script :
# Copyright (C) 2006 OpenWrt.org
#!/bin/sh
# root
tc qdisc del dev eth0.1 root
tc qdisc add dev eth0.1 root handle 1: htb default 10
tc class add dev eth0.1 parent 1: classid 1:1 htb rate 240kbit ceil 240kbit
# branche illimitee
tc class add dev eth0.1 parent 1:1 classid 1:10 htb rate 100kbit ceil 100kbit prio 1 # burst 80k
tc class add dev eth0.1 parent 1:1 classid 1:20 htb rate 60kbit ceil 60kbit prio 2
tc qdisc add dev eth0.1 parent 1:10 handle 10: pfifo # as fast as possible
tc qdisc add dev eth0.1 parent 1:20 handle 20: sfq perturb 10 # stochiastik fairness (for ssh and vnc)
# branche principale (pour tout)
tc class add dev eth0.1 parent 1:1 classid 1:30 htb rate 40kbit ceil 40kbit prio 3 burst 2k
tc qdisc add dev eth0.1 parent 1:30 handle 30: sfq perturb 10
And here is my forewall setting :
#TOS sur l'upload :
# manual TOS!
iptables -t mangle -A FORWARD -p tcp --dport 9100:9101 -j CLASSIFY --set-class 1:10
# prioritise outbound TCP control packets without a payload (ie they're short.)
# This will tend to pull inbound packets faster (especially good on an assymmetric link.)
iptables -t mangle -A POSTROUTING -o eth0.0 -p tcp --syn -m length \
--length 40:68 -j CLASSIFY --set-class 1:20
ptables -t mangle -A POSTROUTING -o eth0.0 -p tcp --tcp-flags ALL SYN,ACK -m length \
--length 40:68 -j CLASSIFY --set-class 1:20
iptables -t mangle -A POSTROUTING -o eth0.0 -p tcp --tcp-flags ALL ACK -m length \
--length 40:100 -j CLASSIFY --set-class 1:20
iptables -t mangle -A POSTROUTING -o eth0.0 -p tcp --tcp-flags ALL RST \
-j CLASSIFY --set-class 1:20
iptables -t mangle -A POSTROUTING -o eth0.0 -p tcp --tcp-flags ALL ACK,RST \
-j CLASSIFY --set-class 1:20
iptables -t mangle -A POSTROUTING -o eth0.0 -p tcp --tcp-flags ALL ACK,FIN \
-j CLASSIFY --set-class 1:20
# prioritise ssh, but not long packets because they are scp or sftp.
iptables -t mangle -A POSTROUTING -o eth0.0 -p tcp --sport 22 -m length \
--length 40:100 -j CLASSIFY --set-class 1:20
iptables -t mangle -A POSTROUTING -o eth0.0 -p tcp --dport 22 -m length \
--length 40:100 -j CLASSIFY --set-class 1:20
iptables -t mangle -A FORWARD -p tcp --sport 5040 -j CLASSIFY --set-class 1:20
# port forwarding setting
(...)
But, this as the same effect when connecting via vnc... I'm surely missing something but I can't see what...
Thanks for help!
(Last edited by nosmile on 1 Dec 2007, 13:12)