All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] HTB + IMQ + IPtables marking.
@ 2005-05-18 13:32 Rio Martin.
  2005-05-19  6:07 ` Krystian Antoni
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rio Martin. @ 2005-05-18 13:32 UTC (permalink / raw)
  To: lartc

Folks,
I'm so surprised what happened to my box just in the few weeks lately.
Here is my setup:

INTERNET <----------> [eth0] SHAPER-BOX [eth1] <----------> USER-FARM
both eth0 & eth1 got public ips (202.x.x.x)

Why traffic monitored at eth0 is bigger than eth1 ?
eth1 shaped just exactly the same as rate i defined in HTB.

I just have 1024Kbps from my ISP and i defined the total parent rate for 
768Kbps. But what happened is the traffic monitored at eth0 almost all the 
time eating all the bandwidth we have.

# DOWNSTREAM 768Kbps
/sbin/ip link set imq1 up
/sbin/tc qdisc add dev imq1 root handle 2: htb default 0
/sbin/tc class add dev imq1 parent 2: classid 2:1 htb rate 768Kbit
/sbin/tc class add dev imq1 parent 2:1 classid 2:10 htb rate 128kbit ceil 
768kbit
/sbin/tc class add dev imq1 parent 2:1 classid 2:20 htb rate 128kbit ceil 
768kbit
/sbin/tc filter add dev imq1 parent 2: protocol ip handle 10 fw classid 2:10
/sbin/tc filter add dev imq1 parent 2: protocol ip handle 20 fw classid 2:20
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0  -j IMQ --todev 1

/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.1.0/24 -j MARK 
--set-mark 10
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.2.0/24 -j MARK 
--set-mark 20

Please help me analyze whats wrong.
Thank you.

Regards,
Rio Martin.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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

* Re: [LARTC] HTB + IMQ + IPtables marking.
  2005-05-18 13:32 [LARTC] HTB + IMQ + IPtables marking Rio Martin.
@ 2005-05-19  6:07 ` Krystian Antoni
  2005-05-19 22:13 ` Andy Furniss
  2005-05-20 10:51 ` Rio Martin.
  2 siblings, 0 replies; 4+ messages in thread
From: Krystian Antoni @ 2005-05-19  6:07 UTC (permalink / raw)
  To: lartc


[-- Attachment #1.1: Type: text/plain, Size: 2979 bytes --]

1.
 lines:
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.1.0/24 -j MARK
--set-mark 10
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.2.0/24 -j MARK
--set-mark 20
 should be in this order:
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.1.0/24 -j MARK
--set-mark 10
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.2.0/24 -j MARK
--set-mark 20
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
/usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
 3. performance fix
/sbin/tc class add dev imq1 parent 2: classid 2:1 htb rate 768Kbit
doesnt have CEIL defined? it has to have it defined so your modem wont queue 
packets, making your latency go to meet the sky :-) set it to 90-95% of the 
bandwidth your modem can do
 /sbin/tc class add dev imq1 parent 2: classid 2:1 htb rate 768Kbit ceil 
1000kbit
 4. performance fix
put some leaf qdisc like SFQ.
/sbin/tc qdisc add sfq parent id 2:20 handle 20 : sfq perturb 10
 5. performance fix
in the classes 2:10 and 2:20 you're using only 256kbit of RATE. change it so 
their sum is the rate of their parent. 
 On 5/18/05, Rio Martin. <rio@martin.mu> wrote: 
> 
> Folks,
> I'm so surprised what happened to my box just in the few weeks lately.
> Here is my setup:
> 
> INTERNET <----------> [eth0] SHAPER-BOX [eth1] <----------> USER-FARM
> both eth0 & eth1 got public ips (202.x.x.x)
> 
> Why traffic monitored at eth0 is bigger than eth1 ?
> eth1 shaped just exactly the same as rate i defined in HTB.
> 
> I just have 1024Kbps from my ISP and i defined the total parent rate for
> 768Kbps. But what happened is the traffic monitored at eth0 almost all the
> time eating all the bandwidth we have.
> 
> # DOWNSTREAM 768Kbps
> /sbin/ip link set imq1 up
> /sbin/tc qdisc add dev imq1 root handle 2: htb default 0
> /sbin/tc class add dev imq1 parent 2: classid 2:1 htb rate 768Kbit
> /sbin/tc class add dev imq1 parent 2:1 classid 2:10 htb rate 128kbit ceil
> 768kbit
> /sbin/tc class add dev imq1 parent 2:1 classid 2:20 htb rate 128kbit ceil
> 768kbit
> /sbin/tc filter add dev imq1 parent 2: protocol ip handle 10 fw classid 
> 2:10
> /sbin/tc filter add dev imq1 parent 2: protocol ip handle 20 fw classid 
> 2:20
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
> 
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.1.0/24 -j MARK
> --set-mark 10
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.2.0/24 -j MARK
> --set-mark 20
> 
> Please help me analyze whats wrong.
> Thank you.
> 
> Regards,
> Rio Martin.
> _______________________________________________
> LARTC mailing list
> LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
> 



-- 
Miłego Dnia
Krystian Antoni

[-- Attachment #1.2: Type: text/html, Size: 3705 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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

* Re: [LARTC] HTB + IMQ + IPtables marking.
  2005-05-18 13:32 [LARTC] HTB + IMQ + IPtables marking Rio Martin.
  2005-05-19  6:07 ` Krystian Antoni
@ 2005-05-19 22:13 ` Andy Furniss
  2005-05-20 10:51 ` Rio Martin.
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Furniss @ 2005-05-19 22:13 UTC (permalink / raw)
  To: lartc

Rio Martin. wrote:
> Folks,
> I'm so surprised what happened to my box just in the few weeks lately.
> Here is my setup:
> 
> INTERNET <----------> [eth0] SHAPER-BOX [eth1] <----------> USER-FARM
> both eth0 & eth1 got public ips (202.x.x.x)
> 
> Why traffic monitored at eth0 is bigger than eth1 ?
> eth1 shaped just exactly the same as rate i defined in HTB.
> 
> I just have 1024Kbps from my ISP and i defined the total parent rate for 
> 768Kbps. But what happened is the traffic monitored at eth0 almost all the 
> time eating all the bandwidth we have.
> 
> # DOWNSTREAM 768Kbps
> /sbin/ip link set imq1 up
> /sbin/tc qdisc add dev imq1 root handle 2: htb default 0
> /sbin/tc class add dev imq1 parent 2: classid 2:1 htb rate 768Kbit
> /sbin/tc class add dev imq1 parent 2:1 classid 2:10 htb rate 128kbit ceil 
> 768kbit
> /sbin/tc class add dev imq1 parent 2:1 classid 2:20 htb rate 128kbit ceil 
> 768kbit
> /sbin/tc filter add dev imq1 parent 2: protocol ip handle 10 fw classid 2:10
> /sbin/tc filter add dev imq1 parent 2: protocol ip handle 20 fw classid 2:20
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0  -j IMQ --todev 1

You only need one -j IMQ here.

> 
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.1.0/24 -j MARK 
> --set-mark 10
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.2.0/24 -j MARK 
> --set-mark 20

You will get away with the mark after -j imq - but it doesn't look very 
elegant :-)

> 
> Please help me analyze whats wrong.

Assuming tc -s class or qdisc ls dev imq1 shows everything is getting 
there OK then I think the problem is that htbs quelength is far too long 
for your link.

You are also shaping from the wrong end of the bottleneck so the queues 
only fill slowly.

Add queues to your htb leaf classes so you can set the length, if you 
choose sfq use the limit option as the 128 packet default is too long.


Andy.

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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

* Re: [LARTC] HTB + IMQ + IPtables marking.
  2005-05-18 13:32 [LARTC] HTB + IMQ + IPtables marking Rio Martin.
  2005-05-19  6:07 ` Krystian Antoni
  2005-05-19 22:13 ` Andy Furniss
@ 2005-05-20 10:51 ` Rio Martin.
  2 siblings, 0 replies; 4+ messages in thread
From: Rio Martin. @ 2005-05-20 10:51 UTC (permalink / raw)
  To: lartc

I tried your way for the whole day.
but still with the same result.

Maybe i'll try just like Andy Furmis said.
set some limit to SFQ.

Regards,
Rio Martin.


On Thursday 19 May 2005 06:07, Krystian Antoni wrote:
> 1.
>  lines:
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.1.0/24 -j MARK
> --set-mark 10
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.2.0/24 -j MARK
> --set-mark 20
>  should be in this order:
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.1.0/24 -j MARK
> --set-mark 10
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -d 202.x.2.0/24 -j MARK
> --set-mark 20
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
> /usr/sbin/iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 1
>  3. performance fix
> /sbin/tc class add dev imq1 parent 2: classid 2:1 htb rate 768Kbit
> doesnt have CEIL defined? it has to have it defined so your modem wont
> queue packets, making your latency go to meet the sky :-) set it to 90-95%
> of the bandwidth your modem can do
>  /sbin/tc class add dev imq1 parent 2: classid 2:1 htb rate 768Kbit ceil
> 1000kbit
>  4. performance fix
> put some leaf qdisc like SFQ.
> /sbin/tc qdisc add sfq parent id 2:20 handle 20 : sfq perturb 10
>  5. performance fix
> in the classes 2:10 and 2:20 you're using only 256kbit of RATE. change it
> so their sum is the rate of their parent.
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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

end of thread, other threads:[~2005-05-20 10:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-18 13:32 [LARTC] HTB + IMQ + IPtables marking Rio Martin.
2005-05-19  6:07 ` Krystian Antoni
2005-05-19 22:13 ` Andy Furniss
2005-05-20 10:51 ` Rio Martin.

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.