Hi, with the attached config my gaming ping is still +20ms, even if the line isn''t saturated..can anybody give me a hint how to get a better response time? my line: 1024/128kbit outbound: one htb qdisc for gaming (7kbps) prio 0 ceil 14kbps<- should get more traffic when needed. Htb again for irc and default. inbound: css, irc, p2p, default <- same shema as before, give css enough bandwith and allocate the rest for the other classes. Are packets in 1:10 (css) are transfered as fast as they arrive? Same config without line breaks: http://phpfi.com/140959 #!/bin/bash OUTBOUND_DEV=ppp0 INBOUND_DEV=imq0 start_outbound() { echo "Starting outbound" tc qdisc add dev ppp0 root handle 1: htb default 90 #max upload tc class add dev ppp0 parent 1: classid 1:1 htb rate 14kbps #css tc class add dev ppp0 parent 1:1 classid 1:10 htb rate 9kbps ceil 14kbps prio 1 iptables -t mangle -A POSTROUTING -p tcp --dport 27020:27039 -j CLASSIFY --set-class 1:10 iptables -t mangle -A POSTROUTING -p udp --dport 27000:27015 -j CLASSIFY --set-class 1:10 #irc tc class add dev ppp0 parent 1:1 classid 1:20 htb rate 1kbps ceil 1kbps prio 2 iptables -t mangle -A POSTROUTING -p tcp --dport 6667 -j CLASSIFY --set-class 1:20 #default tc class add dev ppp0 parent 1:1 classid 1:90 htb rate 4kbps ceil 4kbps prio 3 } stop_outbound_tc() { echo "Stopping outbound tc" tc qdisc del dev ppp0 root 2> /dev/null > /dev/null tc qdisc del dev ppp0 ingress 2> /dev/null > /dev/null } stop_outbound_iptables() { echo "Stopping outbound iptables" #css iptables -t mangle -D POSTROUTING -p tcp --dport 27020:27039 -j CLASSIFY --set-class 1:10 iptables -t mangle -D POSTROUTING -p udp --dport 27000:27015 -j CLASSIFY --set-class 1:10 #irc iptables -t mangle -D POSTROUTING -p tcp --dport 6667 -j CLASSIFY --set-class 1:20 #default iptables -t mangle -D POSTROUTING -j CLASSIFY --set-class 1:90 } start_inbound_device() { echo "Starting inbound device" ip link set $INBOUND_DEV up } stop_inbound_device() { echo "Stopping inbound device" ip link set $INBOUND_DEV down } start_inbound() { echo "Starting inbound" tc qdisc add dev imq0 root handle 1: htb default 90 #max download rate tc class add dev $INBOUND_DEV parent 1: classid 1:1 htb rate 110kbps #css tc class add dev $INBOUND_DEV parent 1:1 classid 1:10 htb rate 30kbps ceil 110kbps prio 1 iptables -t mangle -A PREROUTING -i ppp0 -p udp --sport 27000:27015 -j MARK --set-mark 1 iptables -t mangle -A PREROUTING -i ppp0 -p tcp --sport 27020:27039 -j MARK --set-mark 1 tc filter add dev $INBOUND_DEV parent 1:0 protocol ip prio 1 handle 1 fw classid 1:10 #irc tc class add dev $INBOUND_DEV parent 1:1 classid 1:20 htb rate 10kbps ceil 10kbps prio 2 iptables -t mangle -A PREROUTING -i ppp0 -p tcp --sport 6667 -j MARK --set-mark 2 tc filter add dev $INBOUND_DEV parent 1:0 protocol ip prio 2 handle 2 fw classid 1:20 #p2p tc class add dev $INBOUND_DEV parent 1:1 classid 1:30 htb rate 40kbps ceil 40kbps prio 3 iptables -t mangle -A PREROUTING -p tcp --dport 6881:6999 -j MARK --set-mark 3 tc filter add dev $INBOUND_DEV parent 1:0 protocol ip prio 3 handle 3 fw classid 1:30 #default tc class add dev $INBOUND_DEV parent 1:1 classid 1:90 htb rate 30kbps ceil 30kbps prio 4 #fetch all incoming stuff and redirect it to imq0 iptables -t mangle -A PREROUTING -i ppp0 -j IMQ --todev 0 } stop_inbound_tc() { echo "Stopping inbound tc" tc qdisc del dev $INBOUND_DEV root 2> /dev/null > /dev/null tc qdisc del dev $INBOUND_DEV ingress 2> /dev/null > /dev/null } stop_inbound_iptables() { echo "Stopping inbound iptables" #css iptables -t mangle -D PREROUTING -i ppp0 -p udp --sport 27000:27015 -j MARK --set-mark 1 iptables -t mangle -D PREROUTING -i ppp0 -p tcp --sport 27020:27039 -j MARK --set-mark 1 #irc iptables -t mangle -D PREROUTING -i ppp0 -p tcp --sport 6667 -j MARK --set-mark 2 #p2p iptables -t mangle -D PREROUTING -p tcp --dport 6881:6999 -j MARK --set-mark 3 #default iptables -t mangle -D PREROUTING -j MARK --set-mark 4 #fetch all incoming stuff and redirect it to imq0 iptables -t mangle -D PREROUTING -i ppp0 -j IMQ --todev 0 } start() { start_outbound start_inbound_device start_inbound } stop() { stop_outbound_tc stop_outbound_iptables stop_inbound_tc stop_inbound_device stop_inbound_iptables } show() { echo "Outbound --- Outbound --- Outbound --- Outbound --- Outbound --- Outbound" echo "qdisc: -------------------------------------" tc -s -d qdisc show dev $OUTBOUND_DEV echo "classes: -----------------------------------" tc -s class show dev $OUTBOUND_DEV echo "filters: -----------------------------------" tc filter show dev $OUTBOUND_DEV echo "Inbound --- Inbound --- Inbound --- Inbound --- Inbound --- Inbound" echo "qdisc: -------------------------------------" tc -s -d qdisc show dev $INBOUND_DEV echo "classes: -----------------------------------" tc -s class show dev $INBOUND_DEV echo "filters: -----------------------------------" tc filter show dev $INBOUND_DEV } case "$1" in start) start ;; stop) stop ;; show) show ;; *) echo "Usage: /etc/init.d/shaper {start|stop|show}" exit 1 ;; esac greets Julius
> Hi,Hi there> > with the attached config my gaming ping is still +20ms, even if the > line isn''t saturated..can anybody give me a hint how to get a better > response time? my line: 1024/128kbitTry using tc filters instead of CLASSIFY and see if that helps. I''ve seen some strange shaping behavior with it... Another thing is prioritizing some of the htb classes. You can set priority 1 for class 1:10 (css) and priority 2 for 1:20, 1:90 (lower is better). This way you''re sure that css is getting max upload speed if any other traffic is fighting his way out of your coputer. You can do the same thing for download, but with your connection I think that upload will be the most likely bottleneck. cheers -- Marek Kierdelewicz Kierownik Dzia?u Systemów Sieciowych, KoBa Manager of Network Systems Department, KoBa tel. (85) 7406466; fax. (85) 7406467 e-mail: admin@koba.pl
Am Dienstag 15 August 2006 17:43 schrieb Marek Kierdelewicz:> > Hi, > > Hi there > > > with the attached config my gaming ping is still +20ms, even if the > > line isn''t saturated..can anybody give me a hint how to get a better > > response time? my line: 1024/128kbit > > Try using tc filters instead of CLASSIFY and see if that helps. I''ve > seen some strange shaping behavior with it...Ive found only one explanation for port ranges on the mailing list and the author wasn''t sure if it was correct...so i ask here: #port range 27020:27039, protocol tcp #iptables -t mangle -A POSTROUTING -p tcp --dport 27020:27039 -j CLASSIFY --set-class 1:10 tc filter add dev ppp0 protocol ip parent 1: prio 1 u32 match ip dport 27020 0x13 match ip protocol 6 0xff flowid 1:10 #port range 27000:27015, protocol udp #iptables -t mangle -A POSTROUTING -p udp --dport 27000:27015 -j CLASSIFY --set-class 1:10 tc filter add dev ppp0 protocol ip parent 1: prio 1 u32 match ip dport 27000 0x21 match ip protocol 17 0xff flowid 1:10 are the tc filters correct for the port ranges and the protocol?> > Another thing is prioritizing some of the htb classes. You can > set priority 1 for class 1:10 (css) and priority 2 for 1:20, 1:90 > (lower is better). This way you''re sure that css is getting max upload > speed if any other traffic is fighting his way out of your coputer. > > You can do the same thing for download, but with your connection I > think that upload will be the most likely bottleneck. > > cheers
> #port range 27020:27039, protocol tcp > > #iptables -t mangle -A POSTROUTING -p tcp --dport 27020:27039 -j > CLASSIFY --set-class 1:10 > tc filter add dev ppp0 protocol ip parent 1: prio 1 u32 match ip > dport 27020 0x13 match ip protocol 6 0xff flowid 1:10 >My choice would be fw filter: iptables -t mangle -A POSTROUTING -p tcp --dport 27020:27039 -j MARK --set-mark 0x10 tc filter add dev ppp0 protocol ip parent 1:0 prio 1 handle 0x10 fw classid 1:10> #port range 27000:27015, protocol udp > > #iptables -t mangle -A POSTROUTING -p udp --dport 27000:27015 -j > CLASSIFY --set-class 1:10 > tc filter add dev ppp0 protocol ip parent 1: prio 1 u32 match ip > dport 27000 0x21 match ip protocol 17 0xff flowid 1:10iptables -t mangle -A POSTROUTING -p udp --dport 27000:27015 -j MARK --set-mark 0x10 (filter same as above...only one needed) tc filter add dev ppp0 protocol ip parent 1:0 prio 1 handle 0x10 fw classid 1:10 Hope that helps. cheers -- Marek Kierdelewicz Kierownik Dzia?u Systemów Sieciowych, KoBa Manager of Network Systems Department, KoBa tel. (85) 7406466; fax. (85) 7406467 e-mail: admin@koba.pl
Am Mittwoch 16 August 2006 00:09 schrieb Marek Kierdelewicz:> > #port range 27020:27039, protocol tcp > > > > #iptables -t mangle -A POSTROUTING -p tcp --dport 27020:27039 -j > > CLASSIFY --set-class 1:10 > > tc filter add dev ppp0 protocol ip parent 1: prio 1 u32 match ip > > dport 27020 0x13 match ip protocol 6 0xff flowid 1:10 > > My choice would be fw filter: > iptables -t mangle -A POSTROUTING -p tcp --dport 27020:27039 -j MARK > --set-mark 0x10 > tc filter add dev ppp0 protocol ip parent 1:0 prio 1 handle 0x10 fw > classid 1:10Ah, thats what you mean. Tried to avoid iptables at all... Thx, will try that tomorrow.> > > #port range 27000:27015, protocol udp > > > > #iptables -t mangle -A POSTROUTING -p udp --dport 27000:27015 -j > > CLASSIFY --set-class 1:10 > > tc filter add dev ppp0 protocol ip parent 1: prio 1 u32 match ip > > dport 27000 0x21 match ip protocol 17 0xff flowid 1:10 > > iptables -t mangle -A POSTROUTING -p udp --dport 27000:27015 -j MARK > --set-mark 0x10 > > (filter same as above...only one needed) > tc filter add dev ppp0 protocol ip parent 1:0 prio 1 handle 0x10 fw > classid 1:10 > > Hope that helps. > > cheersgreets Julius
Julius Junghans wrote:> Hi, > > with the attached config my gaming ping is still +20ms, even if the line isn''t > saturated..can anybody give me a hint how to get a better response time? > my line: 1024/128kbitDoes not saturated mean no other traffic - I mean if you really have 128kbit up eg. dsl then the bitrate latency of a 1500 byte packet is about 90ms so that''s the best jitter you can get. Without tweaking and recompiling htb it''s likely to be 2x that. You also have to consider overheads (you can patch for dsl/atm overheads), and with htb it''s better to have your game class with a high rate and the lesser classes can just borrow the spare. You shouldn''t see any difference in latency with/without htb on the interface - as long as there is no other traffic. If I had 128kbit up I would consider reducing mtu on ppp0 or using netfilter to mss clamp so that outbound bulk packets were smaller. For the ingress shaping to work you need to sacrifice bandwidth - quite alot for some traffic. you also need short queues so you drop packets. If you do not specify htb/hfsc will pickup queue lengths from the interface defaults - 3 for ppp, 32 for imq, 1000 for eth - not always what you want. Use counters to verify your classification is working - iptables -L -v -n tc -s class ls dev ppp0 etc Andy.