Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
* [LARTC] How to use tc to limit bandwidth of a special IP in LAN
@ 2001-06-12  7:59 Chuanbo Xu
  2001-06-12  9:39 ` Manfred Bartz
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Chuanbo Xu @ 2001-06-12  7:59 UTC (permalink / raw)
  To: lartc

hi,

I want to limit bandwidth of a special IP in LAN, when it upload or download from Internet through Linux server. How to use tc to do?

Thanks.  


_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LARTC] How to use tc to limit bandwidth of a special IP in LAN
  2001-06-12  7:59 [LARTC] How to use tc to limit bandwidth of a special IP in LAN Chuanbo Xu
@ 2001-06-12  9:39 ` Manfred Bartz
  2001-06-14  3:13 ` Bob Puff@NLE
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Manfred Bartz @ 2001-06-12  9:39 UTC (permalink / raw)
  To: lartc

Chuanbo Xu <iproute2@btamail.net.cn> writes:

> I want to limit bandwidth of a special IP in LAN, when it upload or
> download from Internet through Linux server. How to use tc to do?

The HOWTO covers this quite well:
        <http://www.linuxdoc.org/HOWTO/Adv-Routing-HOWTO.html>
but there were two hiccups I encountered:
1. with "tc class" the priority must be no more than 8
2. with "tc filter" the priority must be no more than 99

Here is my setup (shortened), modify to suit:

## ROOT Class
tc qdisc add dev eth2 root handle 12: cbq bandwidth 10Mbit avpkt 1400

tc class add dev eth2 parent 12: classid 12:1 cbq bandwidth 10Mbit \
   rate 10Mbit allot 1514 weight 1Mbit prio 2 maxburst 20 avpkt 1400

## FLOWs
# 192.168.2.12 (unbounded)
tc class add dev eth2 parent 12:1 classid 12:212 cbq bandwidth 10Mbit \
   rate 256Kbit allot 1514 weight 25Kbit prio 5 maxburst 20 avpkt 1400

# 192.168.2.13 (bounded)
tc class add dev eth2 parent 12:1 classid 12:213 cbq bandwidth 10Mbit \
   rate 64Kbit allot 1514 weight 6Kbit prio 5 maxburst 20 avpkt 1400 bounded

# unbounded class for local traffic
tc class add dev eth2 parent 12:1 classid 12:300 cbq bandwidth 10Mbit \
   rate 3Mbit allot 1514 weight 300Kbit prio 3 maxburst 20 avpkt 1400

## QDISCs
tc qdisc add dev eth2 parent 12:212 sfq quantum 1514b perturb 15
tc qdisc add dev eth2 parent 12:213 sfq quantum 1514b perturb 15
tc qdisc add dev eth2 parent 12:300 sfq quantum 1514b perturb 15

## FILTERs
# unbounded class (local)
tc filter add dev eth2 parent 12:0 protocol ip prio 10 u32 \
   match ip src 192.168.2.0/24  flowid 12:300

# bounded classes (Internet)
tc filter add dev eth2 parent 12:0 protocol ip prio 20 u32 \
   match ip dst 192.168.2.12 flowid 12:212
tc filter add dev eth2 parent 12:0 protocol ip prio 20 u32 \
   match ip dst 192.168.2.13 flowid 12:213


I have only limited downloads.  To cover uploads as well you need to 
do the same thing for that direction.

-- 
Manfred
----------------------------------------------------------------
NetfilterLogAnalyzer, NetCalc, whois at: <http://logi.cc/linux/>


_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LARTC] How to use tc to limit bandwidth of a special IP in LAN
  2001-06-12  7:59 [LARTC] How to use tc to limit bandwidth of a special IP in LAN Chuanbo Xu
  2001-06-12  9:39 ` Manfred Bartz
@ 2001-06-14  3:13 ` Bob Puff@NLE
  2001-06-15  5:57 ` Stef Coene
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Bob Puff@NLE @ 2001-06-14  3:13 UTC (permalink / raw)
  To: lartc

> I have spent days trying to do the most basic things with these new tools
> that I accomplished in hours with 2.2.x, and have made some progress but it
> does not have to be so difficult.


HOW DO YOU DO THIS IN 2.2.x???  I've been trying to find this info.  So far, no responses from anyone here.  Thanks!

Bob

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LARTC] How to use tc to limit bandwidth of a special IP in LAN
  2001-06-12  7:59 [LARTC] How to use tc to limit bandwidth of a special IP in LAN Chuanbo Xu
                   ` (2 preceding siblings ...)
  2001-06-15  5:57 ` Stef Coene
@ 2001-06-15  5:57 ` Stef Coene
  2001-06-15 14:27 ` Ramin Alidousti
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stef Coene @ 2001-06-15  5:57 UTC (permalink / raw)
  To: lartc


> tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth 10Mbit rate 1Mbit \
> allot 1514 cell 8 weight 100Kbit prio 3 maxburst 20 avpkt 1000 split 1:0 \
> defmap c0
- tc : command
- class : 'owns' a part of the traffic that flows through his parent
- add : add a new class
- dev eth0 : we are working onf device eth0
- parent 1:1 : parent of this class (see also option class)
	number : first part is the major number (equal for all classes and
parent who belongs to each other)
                 second part is the minor number : uniq number
- classid 1:2 : number of the class (first number = first number of
parent)
- cbq : type of class
- bandwidth 10Mbit : bandwidth of parent (should be the same for all
elements with same major number)
- rate 1Mbit : bandwidth of this class
- allot 1514 cell 8 maxburst 10 avpkt 1000 : forget these options for
now, just set them
- weight 100Kbit : Used to divide the traffic in the class.  When you
takes it 10 time less then bandwidth, everything will be fine
- split 1:0 defmap c0 :  ? ? ? ? Maybe to split the traffic?  I never
needed this options, so I don't know what this mean.  Just forget this
option for now.

> 
> A small note on all these options would have saved me a lot of guess-work.
Better? ;-)

> 
> But anyway, don't take me wrong. I think that iproute2 is one of the coolest
> networking tools I've ever seen.
Me to, you can do great things with CBQ but it really sucks and is not
accurate enough.

> 
> Ramin
> 
> >
> > -jwb
> 
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

-- 

Stef

More QOS info : http://users.belgacom.net/staf/

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LARTC] How to use tc to limit bandwidth of a special IP in LAN
  2001-06-12  7:59 [LARTC] How to use tc to limit bandwidth of a special IP in LAN Chuanbo Xu
  2001-06-12  9:39 ` Manfred Bartz
  2001-06-14  3:13 ` Bob Puff@NLE
@ 2001-06-15  5:57 ` Stef Coene
  2001-06-15  5:57 ` Stef Coene
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stef Coene @ 2001-06-15  5:57 UTC (permalink / raw)
  To: lartc


> tc class add dev eth1 parent 1:1 classid 1:2 cbq bandwidth 10Mbit rate 1Mbit \
> allot 1514 cell 8 weight 100Kbit prio 3 maxburst 20 avpkt 1000 split 1:0 \
> defmap c0
- tc : command
- class : 'owns' a part of the traffic that flows through his parent
- add : add a new class
- dev eth0 : we are working onf device eth0
- parent 1:1 : parent of this class (see also option class)
	number : first part is the major number (equal for all classes and
parent who belongs to each other)
                 second part is the minor number : uniq number
- classid 1:2 : number of the class (first number = first number of
parent)
- cbq : type of class
- bandwidth 10Mbit : bandwidth of parent (should be the same for all
elements with same major number)
- rate 1Mbit : bandwidth of this class
- allot 1514 cell 8 maxburst 10 avpkt 1000 : forget these options for
now, just set them
- weight 100Kbit : Used to divide the traffic in the class.  When you
takes it 10 time less then bandwidth, everything will be fine
- split 1:0 defmap c0 :  ? ? ? ? Maybe to split the traffic?  I never
needed this options, so I don't know what this mean.  Just forget this
option for now.

> 
> A small note on all these options would have saved me a lot of guess-work.
Better? ;-)

> 
> But anyway, don't take me wrong. I think that iproute2 is one of the coolest
> networking tools I've ever seen.
Me to, you can do great things with CBQ but it really sucks and is not
accurate enough.

> 
> Ramin
> 
> >
> > -jwb
> 
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

-- 

Stef

More QOS info : http://users.belgacom.net/staf/


_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LARTC] How to use tc to limit bandwidth of a special IP in LAN
  2001-06-12  7:59 [LARTC] How to use tc to limit bandwidth of a special IP in LAN Chuanbo Xu
                   ` (3 preceding siblings ...)
  2001-06-15  5:57 ` Stef Coene
@ 2001-06-15 14:27 ` Ramin Alidousti
  2001-06-18  5:40 ` Stef Coene
  2001-06-18  5:40 ` Stef Coene
  6 siblings, 0 replies; 8+ messages in thread
From: Ramin Alidousti @ 2001-06-15 14:27 UTC (permalink / raw)
  To: lartc

Thanks Stef :-)

On Fri, Jun 15, 2001 at 07:57:12AM +0200, Stef Coene wrote:

> - allot 1514 cell 8 maxburst 10 avpkt 1000 : forget these options for
> now, just set them

That's exactly what I meant.

> - split 1:0 defmap c0 :  ? ? ? ? Maybe to split the traffic?  I never
> needed this options, so I don't know what this mean.  Just forget this
> option for now.

You will never need something when you don't know of its existance ;-)

> > A small note on all these options would have saved me a lot of guess-work.
> Better? ;-)

Yes. Much better :-)

> > But anyway, don't take me wrong. I think that iproute2 is one of the coolest
> > networking tools I've ever seen.
> Me to, you can do great things with CBQ but it really sucks and is not
> accurate enough.

Why do you need accuracy when you're doing "Traffic Engineering" ;-)

Ramin


_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LARTC] How to use tc to limit bandwidth of a special IP in LAN
  2001-06-12  7:59 [LARTC] How to use tc to limit bandwidth of a special IP in LAN Chuanbo Xu
                   ` (5 preceding siblings ...)
  2001-06-18  5:40 ` Stef Coene
@ 2001-06-18  5:40 ` Stef Coene
  6 siblings, 0 replies; 8+ messages in thread
From: Stef Coene @ 2001-06-18  5:40 UTC (permalink / raw)
  To: lartc

Ramin Alidousti wrote:
> 
> Thanks Stef :-)
> 
> On Fri, Jun 15, 2001 at 07:57:12AM +0200, Stef Coene wrote:
> 
> > - allot 1514 cell 8 maxburst 10 avpkt 1000 : forget these options for
> > now, just set them
> 
> That's exactly what I meant.
> 
> > - split 1:0 defmap c0 :  ? ? ? ? Maybe to split the traffic?  I never
> > needed this options, so I don't know what this mean.  Just forget this
> > option for now.
> 
> You will never need something when you don't know of its existance ;-)
> 
> > > A small note on all these options would have saved me a lot of guess-work.
> > Better? ;-)
> 
> Yes. Much better :-)
> 
> > > But anyway, don't take me wrong. I think that iproute2 is one of the coolest
> > > networking tools I've ever seen.
> > Me to, you can do great things with CBQ but it really sucks and is not
> > accurate enough.
> 
> Why do you need accuracy when you're doing "Traffic Engineering" ;-)
I did some tests : I tried to give 2 hosts a bandwidth og 128kbit/s. 
Host A needs 75% of this bandwidth and host B 25%.  They share the same
128kbit/s so they may borrow unused bandwidth.  The only way to do this
is to create a qdisc on a bounded class of 128kbit/s (I tried all other
things and this was the only way to get it working).  On this qdisc you
can attach 2 classes for the two hosts with appropriate optiones and it
works perfect.  Host A gets 75% of the bandwidth and they can borrow
bandwidth. 
BUT, the problem is the bounded class and qdisc.  I did some tests and
CBQ is very bad when it has to bound a class, but the problem is that
you need a bounded class with his rate equal to the link-bandwidth.  You
can find some nice pictures on my website and they are very clear
(http://users.belgacom.net/staf/qos/tests/cbq/bounded/bounded-accuracy.html):
CBQ is not accurate when bounding a class.  So it's working but not
accurate enough.  There are some other problems, but this the most
inportant.

So if anyone out there has other results or find a solution, plz let us
know.  I did a lot of testing and I'm surre I didn't made a mistake.  I
made all the possible combinations of options, and each time it was not
working like I wanted to.



-- 

Stef

More QOS info : http://users.belgacom.net/staf/

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [LARTC] How to use tc to limit bandwidth of a special IP in LAN
  2001-06-12  7:59 [LARTC] How to use tc to limit bandwidth of a special IP in LAN Chuanbo Xu
                   ` (4 preceding siblings ...)
  2001-06-15 14:27 ` Ramin Alidousti
@ 2001-06-18  5:40 ` Stef Coene
  2001-06-18  5:40 ` Stef Coene
  6 siblings, 0 replies; 8+ messages in thread
From: Stef Coene @ 2001-06-18  5:40 UTC (permalink / raw)
  To: lartc

Ramin Alidousti wrote:
> 
> Thanks Stef :-)
> 
> On Fri, Jun 15, 2001 at 07:57:12AM +0200, Stef Coene wrote:
> 
> > - allot 1514 cell 8 maxburst 10 avpkt 1000 : forget these options for
> > now, just set them
> 
> That's exactly what I meant.
> 
> > - split 1:0 defmap c0 :  ? ? ? ? Maybe to split the traffic?  I never
> > needed this options, so I don't know what this mean.  Just forget this
> > option for now.
> 
> You will never need something when you don't know of its existance ;-)
> 
> > > A small note on all these options would have saved me a lot of guess-work.
> > Better? ;-)
> 
> Yes. Much better :-)
> 
> > > But anyway, don't take me wrong. I think that iproute2 is one of the coolest
> > > networking tools I've ever seen.
> > Me to, you can do great things with CBQ but it really sucks and is not
> > accurate enough.
> 
> Why do you need accuracy when you're doing "Traffic Engineering" ;-)
I did some tests : I tried to give 2 hosts a bandwidth og 128kbit/s. 
Host A needs 75% of this bandwidth and host B 25%.  They share the same
128kbit/s so they may borrow unused bandwidth.  The only way to do this
is to create a qdisc on a bounded class of 128kbit/s (I tried all other
things and this was the only way to get it working).  On this qdisc you
can attach 2 classes for the two hosts with appropriate optiones and it
works perfect.  Host A gets 75% of the bandwidth and they can borrow
bandwidth. 
BUT, the problem is the bounded class and qdisc.  I did some tests and
CBQ is very bad when it has to bound a class, but the problem is that
you need a bounded class with his rate equal to the link-bandwidth.  You
can find some nice pictures on my website and they are very clear
(http://users.belgacom.net/staf/qos/tests/cbq/bounded/bounded-accuracy.html):
CBQ is not accurate when bounding a class.  So it's working but not
accurate enough.  There are some other problems, but this the most
inportant.

So if anyone out there has other results or find a solution, plz let us
know.  I did a lot of testing and I'm surre I didn't made a mistake.  I
made all the possible combinations of options, and each time it was not
working like I wanted to.



-- 

Stef

More QOS info : http://users.belgacom.net/staf/


_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-06-18  5:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-12  7:59 [LARTC] How to use tc to limit bandwidth of a special IP in LAN Chuanbo Xu
2001-06-12  9:39 ` Manfred Bartz
2001-06-14  3:13 ` Bob Puff@NLE
2001-06-15  5:57 ` Stef Coene
2001-06-15  5:57 ` Stef Coene
2001-06-15 14:27 ` Ramin Alidousti
2001-06-18  5:40 ` Stef Coene
2001-06-18  5:40 ` Stef Coene

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox