Re: RES: kernel configuration and tc commands for traffic shaping

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 25, 2004 at 03:46:32PM -0300, Antonio Luiz wrote:
> You can try this (adapted from
> http://www.knowplace.org/shaper/examples.html):
> 
>   tc qdisc add dev ppp0 root handle 1: htb default 60   
>   tc class add dev ppp0 parent 1:1 classid 1:10 htb rate 10kbit ceil \
>             $MAXSPEEDkbit prio 0
>   tc filter add dev ppp0 protocol ip parent 1:0 protocol ip prio 1 u32 \
>             match ip dport 80 0xffff \
>             match ip src $SOMEIPADDRESS \
>             police rate 10kbit flowid 1:10

Very useful link and code.


I changed it a bit, though. This is what I used.

    tc qdisc add dev ppp0 root handle 1: htb
    tc class add dev ppp0 parent 1: classid 1:1 htb rate $MAXSPEEDkbit
    iptables --table mangle --insert POSTROUTING \
             --protocol tcp \
             --source $IPADDRESS --destination-port 80 \
             --jump CLASSIFY --set-class 1:1


Here are some consideration, though.

- Isn't 'default' supposed to suggest a default subclass
  id? What does the 60 in your 'tc qdisc' line refer to?


- The parent you specified in 'tc class' line' doesn't 
  exist as far as I understood. If I type that command it 
  seems to work anyhow. What am I missing?


- What does the parent in your 'tc filter' line refer to?
 

- I assume $MAXSPEED is the speed you that traffic to be 
  shaped like. I used 'rate $MAXSPEEDkbit' instead of 
  'rate 10kbit ceil $MAXSPEEDkbit' and it seems to work.
  What is the difference betweem these two versions?


- Instead of the 'tc filter' line I used a iptables rule. 
  This way I was able to add to the kernel just the HTB 
  support. Otherwise as far as I understood I would have 
  had to add other filter related things.

  Furthermore http://www.knowplace.org/shaper/ suggests to 
  use iptables CLASSIFY when possible. What do you think 
  about it? What are the advantages and disadvantage of 
  the approaches reported?

    1) tc filter
    2) iptables marking with tc filter
    3) iptables classify


  Personally I love the third. It's very human readable 
  and, if I understood well, once you set a class with 
  the same name on every interface, with iptables you can 
  use just a single line to filter all the packets while 
  with tc filter you would have to specify a filter for 
  every single interface.


- Why did you use a source-ip/destination-port combination 
  instead of a destination-ip/source-port one?



Thanks in advance.

Best regards.
-- 
Value your freedom, or you will lose it, teaches history. 
``Don't bother us with politics,'' respond those who don't 
want to learn.

 -- Richard M. Stallman
    http://www.gnu.org/philosophy/linux-gnu-freedom.html

Attachment: pgpwyOlsAbP1a.pgp
Description: PGP signature


[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux