All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] Managing Inbound Traffic
@ 2002-08-09 22:10 Wayne de Nobrega
  2002-08-10  9:10 ` Stef Coene
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Wayne de Nobrega @ 2002-08-09 22:10 UTC (permalink / raw)
  To: lartc

[-- Attachment #1: Type: text/plain, Size: 2229 bytes --]

I have been playing around with traffic shaping using htb and imq but am
battling to get any control over the inbound traffic.  Managing the
outgoing is working perfectly.  To manage the inbound internet traffic
which is running on a 64kbit line, I have tried the following including
various permutations of priorities, bursts, and ceilings with no affect.
(Does the ceil option work becuase when I did have it set higher than
the rate, the traffic did not increase even with no other traffic on the
line. I noticed the same thing with the burst option.  I cannot place
the shaper at the ISP in this case.
 
modprobe imq numdevs=1
 
tc qdisc add dev imq0 handle 1: root htb default 1
tc class add dev imq0 parent 1: classid 1:1 htb rate 64kbit
 
tc qdisc add dev imq0 parent 1:1 handle 10: htb default 5
tc class add dev imq0 parent 10: classid 10:1 htb rate 12kbit burst
16kbit prio 3
tc class add dev imq0 parent 10: classid 10:2 htb rate 28kbit burst
16kbit prio 2
tc class add dev imq0 parent 10: classid 10:3 htb rate 16kbit burst
16kbit prio 1
tc class add dev imq0 parent 10: classid 10:5 htb rate 8kbit prio 4
 
tc qdisc add dev imq0 parent 10:1 handle 21:0 sfq
tc qdisc add dev imq0 parent 10:2 handle 22:0 sfq
tc qdisc add dev imq0 parent 10:3 handle 23:0 sfq
tc qdisc add dev imq0 parent 10:5 handle 24:0 sfq
 
tc filter add dev imq0 protocol ip pref 1 parent 10: handle 1 fw classid
10:1
tc filter add dev imq0 protocol ip pref 2 parent 10: handle 2 fw classid
10:2
tc filter add dev imq0 protocol ip pref 3 parent 10: handle 3 fw classid
10:3
 
iptables -t mangle -A PREROUTING -i eth0 -j IMQ
iptables -t mangle -A PREROUTING -i eth0 -p tcp --sport 20 --dport 1024:
-m state --state ESTABLISHED -j MARK --set-mark 1
iptables -t mangle -A PREROUTING -i eth0 -p tcp --sport 80 --dport 1024:
-m state --state ESTABLISHED -j MARK --set-mark 2
iptables -t mangle -A PREROUTING -i eth0 -p tcp --sport 22 --dport 1024:
-m state --state ESTABLISHED -j MARK --set-mark 3
 
ip link set imq0 up

What I want to have is that they all have a minimum rate set which can
grow to fill the line if it is available.  
 
Any help or ideas if this is possible???
 
Thanks

Wayne
 

[-- Attachment #2: Type: text/html, Size: 3551 bytes --]

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

* Re: [LARTC] Managing Inbound Traffic
  2002-08-09 22:10 [LARTC] Managing Inbound Traffic Wayne de Nobrega
@ 2002-08-10  9:10 ` Stef Coene
  2002-08-10  9:58 ` Arindam Haldar
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stef Coene @ 2002-08-10  9:10 UTC (permalink / raw)
  To: lartc

> tc class add dev imq0 parent 10: classid 10:1 htb rate 12kbit burst
> 16kbit prio 3
> tc class add dev imq0 parent 10: classid 10:2 htb rate 28kbit burst
> 16kbit prio 2
> tc class add dev imq0 parent 10: classid 10:3 htb rate 16kbit burst
> 16kbit prio 1
> tc class add dev imq0 parent 10: classid 10:5 htb rate 8kbit prio 4
>
> tc qdisc add dev imq0 parent 10:1 handle 21:0 sfq
> tc qdisc add dev imq0 parent 10:2 handle 22:0 sfq
> tc qdisc add dev imq0 parent 10:3 handle 23:0 sfq
> tc qdisc add dev imq0 parent 10:5 handle 24:0 sfq
>
> tc filter add dev imq0 protocol ip pref 1 parent 10: handle 1 fw classid
> 10:1
> tc filter add dev imq0 protocol ip pref 2 parent 10: handle 2 fw classid
> 10:2
> tc filter add dev imq0 protocol ip pref 3 parent 10: handle 3 fw classid
> 10:3
>
> iptables -t mangle -A PREROUTING -i eth0 -j IMQ
> iptables -t mangle -A PREROUTING -i eth0 -p tcp --sport 20 --dport 1024:
> -m state --state ESTABLISHED -j MARK --set-mark 1
> iptables -t mangle -A PREROUTING -i eth0 -p tcp --sport 80 --dport 1024:
> -m state --state ESTABLISHED -j MARK --set-mark 2
> iptables -t mangle -A PREROUTING -i eth0 -p tcp --sport 22 --dport 1024:
> -m state --state ESTABLISHED -j MARK --set-mark 3
>
> ip link set imq0 up
>
> What I want to have is that they all have a minimum rate set which can
> grow to fill the line if it is available.
>
> Any help or ideas if this is possible???
You have to give each class a ceil of 64 kbit.  So the classes can borrow 
bandwidth from the parent up to 64 kbit.  On the other hand, 64kbit is too 
high.  You have to make sure you never receive more packets then the modem 
can handle.  So ceiling at 62kbit will give better results (at least that's 
what I hope :).

Stef

-- 

stef.coene@docum.org
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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

* [LARTC] Managing Inbound Traffic
  2002-08-09 22:10 [LARTC] Managing Inbound Traffic Wayne de Nobrega
  2002-08-10  9:10 ` Stef Coene
@ 2002-08-10  9:58 ` Arindam Haldar
  2002-08-12 19:59 ` Thomas SPECK
  2002-08-12 20:04 ` Stef Coene
  3 siblings, 0 replies; 5+ messages in thread
From: Arindam Haldar @ 2002-08-10  9:58 UTC (permalink / raw)
  To: lartc

hi,
i have added just these iptables command to handle in & out traffice 
thru the same imq0
markOut="$ipt -A FORWARD -t mangle -o eth0 -j MARK -s "
markIn="$ipt -A FORWARD -t mangle -o eth1 -j MARK -d "

$markOut 192.168.1.20 --set-mark 1
$markIn 192.168.1.20 --set-mark 1

$ipt -A POSTROUTING -t mangle -j IMQ

rest of the htb & imq rules are same like you  :)

A.H

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

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

* Re: [LARTC] Managing Inbound Traffic
  2002-08-09 22:10 [LARTC] Managing Inbound Traffic Wayne de Nobrega
  2002-08-10  9:10 ` Stef Coene
  2002-08-10  9:58 ` Arindam Haldar
@ 2002-08-12 19:59 ` Thomas SPECK
  2002-08-12 20:04 ` Stef Coene
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas SPECK @ 2002-08-12 19:59 UTC (permalink / raw)
  To: lartc

>Messsage du 10/08/2002 00:10
>De : Wayne de Nobrega <wdenobre@techconcepts.co.za>
>A :  <lartc@mailman.ds9a.nl>
>Copie à : 
>Objet : [LARTC] Managing Inbound Traffic  
>
> I have been playing around with traffic shaping using htb and imq but am
> battling to get any control over the inbound traffic.  Managing the
> outgoing is working perfectly.  To manage the inbound internet traffic
> which is running on a 64kbit line, I have tried the following including
> various permutations of priorities, bursts, and ceilings with no affect.
> (Does the ceil option work becuase when I did have it set higher than
> the rate, the traffic did not increase even with no other traffic on the
> line. I noticed the same thing with the burst option.  I cannot place
> the shaper at the ISP in this case.
>  
> modprobe imq numdevs=1
>  
> tc qdisc add dev imq0 handle 1: root htb default 1
> tc class add dev imq0 parent 1: classid 1:1 htb rate 64kbit
>  
> tc qdisc add dev imq0 parent 1:1 handle 10: htb default 5
> tc class add dev imq0 parent 10: classid 10:1 htb rate 12kbit burst
> 16kbit prio 3
> tc class add dev imq0 parent 10: classid 10:2 htb rate 28kbit burst
> 16kbit prio 2
> tc class add dev imq0 parent 10: classid 10:3 htb rate 16kbit burst
> 16kbit prio 1
> tc class add dev imq0 parent 10: classid 10:5 htb rate 8kbit prio 4
>  
> tc qdisc add dev imq0 parent 10:1 handle 21:0 sfq
> tc qdisc add dev imq0 parent 10:2 handle 22:0 sfq
> tc qdisc add dev imq0 parent 10:3 handle 23:0 sfq
> tc qdisc add dev imq0 parent 10:5 handle 24:0 sfq
>  
> tc filter add dev imq0 protocol ip pref 1 parent 10: handle 1 fw classid
> 10:1
> tc filter add dev imq0 protocol ip pref 2 parent 10: handle 2 fw classid
> 10:2
> tc filter add dev imq0 protocol ip pref 3 parent 10: handle 3 fw classid
> 10:3
>  
> iptables -t mangle -A PREROUTING -i eth0 -j IMQ
> iptables -t mangle -A PREROUTING -i eth0 -p tcp --sport 20 --dport 1024:
> -m state --state ESTABLISHED -j MARK --set-mark 1
> iptables -t mangle -A PREROUTING -i eth0 -p tcp --sport 80 --dport 1024:
> -m state --state ESTABLISHED -j MARK --set-mark 2
> iptables -t mangle -A PREROUTING -i eth0 -p tcp --sport 22 --dport 1024:
> -m state --state ESTABLISHED -j MARK --set-mark 3

I wonder if this is true. Shouldn't one rather use iptables -t mangle -A PREROUTING -i eth0 -j IMQ at the end (after the other rules) ? Otherwise everyting from eth0 will go right to target IMQ and the other rules are never executed, i.e. the desired packets are never marked and all the filters are never true ...

--
Thomas




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

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

* Re: [LARTC] Managing Inbound Traffic
  2002-08-09 22:10 [LARTC] Managing Inbound Traffic Wayne de Nobrega
                   ` (2 preceding siblings ...)
  2002-08-12 19:59 ` Thomas SPECK
@ 2002-08-12 20:04 ` Stef Coene
  3 siblings, 0 replies; 5+ messages in thread
From: Stef Coene @ 2002-08-12 20:04 UTC (permalink / raw)
  To: lartc

> I wonder if this is true. Shouldn't one rather use iptables -t mangle -A
> PREROUTING -i eth0 -j IMQ at the end (after the other rules) ? Otherwise
> everyting from eth0 will go right to target IMQ and the other rules are
> never executed, i.e. the desired packets are never marked and all the
> filters are never true ...
The script is ok.
The iptables command registers netfilter hooks.  The order you enter the 
commands is not important.
For ingress, the imq rules are processed just after the mangle rules.  So you 
can use the iptable mark when filtering on the imq device.  For egress, the 
imq rules are matched after all iptables rules.
The packet is only queued in the imq device if it passes all previous rules.

Stef

-- 

stef.coene@docum.org
 "Using Linux as bandwidth manager"
     http://www.docum.org/
     #lartc @ irc.oftc.net
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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

end of thread, other threads:[~2002-08-12 20:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-09 22:10 [LARTC] Managing Inbound Traffic Wayne de Nobrega
2002-08-10  9:10 ` Stef Coene
2002-08-10  9:58 ` Arindam Haldar
2002-08-12 19:59 ` Thomas SPECK
2002-08-12 20:04 ` Stef Coene

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.