LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 08-01-2005, 10:15 PM   #1
diaskimo
LQ Newbie
 
Registered: Aug 2005
Posts: 4

Rep: Reputation: 0
Question QoS with HTB


Dear All,

I have changed our settings as following.
I can guarantee the download speed of PC1's http service around 200kbit.
However, I can't guarantee 200kbit to PC1 when PC2 or PC3 started to download.
Perhaps I am writing the settings wrong? Thanks for your help in advance.

Environment:
[PC1, PC2, PC3] <-->eth0[QoS with Bridage Mode]eth1<--> [NAT]<--> [Internet]
PC1 IP: 192.168.200.11/32
PC2 IP: 192.168.200.22/32
PC3 IP: 192.168.200.33/32


[QoS: tc script]
#!/bin/sh
PATH=$PATH:/usr/local/sbin:/sbin

###### Download setting ######
#Del DL/UL device
tc qdisc del dev eth0 root
tc qdisc del dev eth1 root

#Create DL Device information
tc qdisc add dev eth0 root handle 1: htb default 7
tc class add dev eth0 parent 1: classid 1:1 htb rate 512kbit ceil 512kbit

#Default DL flow
tc class add dev eth0 parent 1:1 classid 1:7 htb rate 10kbit ceil 512kbit prio 7
tc qdisc add dev eth0 parent 1:7 handle 77: sfq perturb 10

#or rate 200kbit ceil 512kbit
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 200kbit ceil 200kbit prio 0
tc qdisc add dev eth0 parent 1:10 handle 10: sfq


##### Upload setting ######
#Create UL Device information
tc qdisc add dev eth1 root handle 1000: htb default 8
tc class add dev eth1 parent 1000: classid 1000:1 htb rate 512kbit ceil 512kbit

#Default UL flow
tc class add dev eth1 parent 1000:1 classid 1000:8 htb rate 10kbit ceil 512kbit prio 7
tc qdisc add dev eth1 parent 1000:8 handle 88: sfq perturb 10


# tc filter add dev eth0 parent 1:0 protocol ip prio 0 handle 10000 fw flowid 1:10
tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.200.11/32 match ip sport 80 0xffff flowid 1:10


Best regards,


Dias
 
Old 08-06-2005, 07:41 AM   #2
frostschutz
Member
 
Registered: Apr 2004
Distribution: Gentoo
Posts: 64

Rep: Reputation: 16
Re: QoS with HTB

Quote:
Originally posted by diaskimo
###### Download setting ######
#Del DL/UL device
tc qdisc del dev eth0 root
tc qdisc del dev eth1 root

#Create DL Device information
tc qdisc add dev eth0 root handle 1: htb default 7
tc class add dev eth0 parent 1: classid 1:1 htb rate 512kbit ceil 512kbit

#Default DL flow
tc class add dev eth0 parent 1:1 classid 1:7 htb rate 10kbit ceil 512kbit prio 7
tc qdisc add dev eth0 parent 1:7 handle 77: sfq perturb 10

#or rate 200kbit ceil 512kbit
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 200kbit ceil 200kbit prio 0
tc qdisc add dev eth0 parent 1:10 handle 10: sfq
For the rate 200kbit ceil 200kbit case, using prio parameter is not necessary since the 'high prio' class does not have to borrow anyway. I don't recall exactly how many prio levels there are in HTB, but they were not many, so maybe prio 7 is too high a value already?

You also should be aware of the shaping download traffic problems. You actually don't have any influence on the packets that are sent to you. All you can do (so far) is drop packets and hope that the other side is using a TCP/IP implementation that tries to send slower in this case.

Also, you are using SFQ. Be aware that SFQ works by reordering packets, which means they are queued (standard queue 128 packets per SFQ) and then shuffled. This can cause delays, thus you should not use SFQ for interactive traffic.

Quote:
##### Upload setting ######
#Create UL Device information
tc qdisc add dev eth1 root handle 1000: htb default 8
tc class add dev eth1 parent 1000: classid 1000:1 htb rate 512kbit ceil 512kbit

#Default UL flow
tc class add dev eth1 parent 1000:1 classid 1000:8 htb rate 10kbit ceil 512kbit prio 7
tc qdisc add dev eth1 parent 1000:8 handle 88: sfq perturb 10
This setup is incomplete. Class 1000:8 is an only child. You only have one leaf class you can put traffic into. In other words, there is no other traffic than default traffic. It actually has always 512kbit worth of traffic, because there is no other class that could borrow that bandwidth away. So all this setup does is limit upload to 512kbit, nothing else.

In HTB, only childs never make sense!
 
Old 08-06-2005, 08:32 AM   #3
diaskimo
LQ Newbie
 
Registered: Aug 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Thumbs up

Thank you very much for your help.
 
Old 08-08-2005, 12:57 AM   #4
diaskimo
LQ Newbie
 
Registered: Aug 2005
Posts: 4

Original Poster
Rep: Reputation: 0
I have changed our settings as following.
I'd like to borrow remaining bandwidth from 1:7 to 1:10.
How do I fix my settings?

prio 0 : High priority
prio 7 : Low priority


[TC script]
#Del DL device
tc qdisc del dev eth0 root

#Create DL Device information
tc qdisc add dev eth0 root handle 1: htb r2q 1 default 7
tc class add dev eth0 parent 1: classid 1:11 htb rate 512kbit ceil 512kbit

#HTTP service
tc class add dev eth0 parent 1:11 classid 1:10 htb rate 350kbit ceil 512kbit prio 0
tc qdisc add dev eth0 parent 1:10 handle 10: pfifo

#Default DL flow
tc class add dev eth0 parent 1:11 classid 1:7 htb rate 150kbit ceil 512kbit prio 7
tc qdisc add dev eth0 parent 1:7 handle 77: pfifo

tc filter add dev eth1 parent 1000:0 protocol ip prio 0 handle 10000 fw flowid 1000:10

#Do I need following settings?
#tc qdisc add dev eth0 handle ffff: ingress
#tc filter add dev eth0 parent ffff: protocol ip prio 7 u32 match ip dst 0.0.0.0/0 police rate 512kbit burst 10k drop flowid :7


[iptables script]
iptables -A FORWARD -t mangle -j CONNMARK --restore-mark
iptables -A FORWARD -t mangle -m mark ! --mark 0 -j ACCEPT
iptables -A FORWARD -p tcp --dport 80 -j MARK --set-mark 10000 -m state --state ESTABLISHED,RELATED -s 192.168.200.115/32 -d 0.0.0.0/0 -t man
gle
iptables -A FORWARD -t mangle -j CONNMARK --save-mark



Best regards,


Dias
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
QoS with HTB: Multi-session problem diaskimo Linux - Networking 0 08-01-2005 08:21 PM
QoS wiht HTB for ADSL/Home ddaas Linux - Networking 1 07-31-2005 07:20 AM
HTB as a child of another HTB - doesn't work ddaas Linux - Networking 5 07-25-2005 03:21 AM
HTB.. qos or what? bcc1981 Mandriva 0 04-16-2004 02:19 PM
HTB QOS. udp rtp rtcp. GT-GEO Linux - General 0 03-02-2002 08:29 AM


All times are GMT -5. The time now is 11:14 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration