[LARTC] Routing SMTP traffic

2003-07-03 Thread Dorneles Treméa
Hi guys,

I have a mail server running qmail with two network
interfaces. All packages comes from the first one and
I want to mark outgoing packages to route them using
the second interface (ADSL).

I have write this script, but it ins't work. All
packages are returning by the first interface... :-(

x-x-x

# Tables, networks, interfaces, addresses and gateways
IF1=eth0
T1=100
NET1=200.180.193.16/29
IP1=200.180.193.18
GW1=200.180.193.20

IF2=eth1
T2=200
NET2=192.168.1.0/24
IP2=192.168.1.100
GW2=192.168.1.1

# Mark packages that have TCP DST PORT 25 with 1
iptables -A PREROUTING -t mangle -p tcp --dport 25 -j MARK --set-mark 1

# Define routing in tables $T1 and $T2
ip route add $NET1 dev $IF1 src $IP1 table $T1
ip route add default via $GW1 table $T1
ip route add $NET2 dev $IF2 src $IP2 table $T2
ip route add default via $GW2 table $T2

# Define routing in table 'main'
ip route add $NET1 dev $IF1 src $IP1
ip route add $NET2 dev $IF2 src $IP2

# Define default route normal
ip route add default via $GW1

# Define routing rule for same interface
ip rule add from $IP1 table $T1
ip rule add from $IP2 table $T2

# Define routing rule for marked packages
ip rule add fwmark 1 table $T2

x-x-x

Could someone enlighten me? :-)

Best regards,

-- 

Dorneles Treméa
Caxias do Sul - RS - Brasil
+55 54 9114 9312 - UIN: 2413568
X3ng Web Technology 

-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCS/IT d- s:->: a23 C+++ UBL$ P--- L++ E-- W+++
N++ o? K? w+ O M+ V-- PS+ PE- Y-- PGP++ t+ 5 X++ R+
tv+ b(++) DI+ D++ G+>+++ e++> h r+++ y+++**
--END GEEK CODE BLOCK--


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] Port Forwarding on two external NATed interfaces? (dual route, fwmark)

2003-07-03 Thread Hanno Mueller
Hi there,

I have a little router here that does this:

   +-- ppp0 (no fwmark)
   |
internal eth0 o Box o--+   external
   |
   +-- eth2 (fwmark 2)


ppp0 is a fast ADSL line at provider A,
eth2 is a slow SDSL line at provider B
I don't use load balancing, the two providers are used for different
purposes depending on the services used by the LAN users.
I have a little fwmark Masq/SNAT configuration with a dual default route
that masquerades the internal LAN onto both external providers. The
fwmark is set depending on the destination port or destination address,
e.g. we send mail over eth2, while web browsing is done over ppp0. This
is transparent for the users and has been working fine for quite some
time now.
The box itself also replies correctly to external requests. It runs a
web server and we can reach it from outside on both ppp0's and eth2's IP
address.
My problem is that I now want to use port forwarding for packets coming
from both of the external networks.
Port forwarding for ppp0 works fine: requests coming in on from ppp0 are
forwarded correctly to the internal IP, the responding packets return
through ppp0.
However, packets coming in from eth2 are not answered on eth2, but on
ppp0, as well. While the incoming packets are forwarded correctly to the
internal IP, the responding packets use the wrong route.
I have tried to set fwmark 2 on all the "mangle" tables for packets
arriving on eth2, yet it still responds on ppp0.
Is there anyone who did something similar? Somehow I think that this
can't really be that obscure to do...
Thanks,

Hanno



___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] What happened if the parent rate lower than children ?

2003-07-03 Thread Stef Coene
On Thursday 03 July 2003 15:27, [EMAIL PROTECTED] wrote:
> Dear folks,
> finally i found something weird after i foolishly try to lower parent rate.
>
> i set parent class rate and ceil to 40kbit
> while children rate i set to 10kbit and ceil to 100kbit
>
> i check the statistic and i couldnt find parent details and rate, missing..
> is this usual ? before i did this foolish thing, statistic for parent such
> as rate is exist..
>
> Help me analyze this ..
What do you mean with you can't find the parent details?  You should be able 
to see them with tc -s -d class show dev ethx .

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] tc and iptables --set-mark question

2003-07-03 Thread Stef Coene
On Thursday 03 July 2003 15:12, Joerg Hartmann wrote:
> Hello,
>
> if i mark packets on my firewall with "iptables" and "--set-mark" (lets
> say .. with --set-mark 0x12 ..) can someone tell me, WHERE in the
> resulting ip packet this data is stored ?
It's stored in kernel memory.  If the packet leaves the box, the mark is gone;

> From the examples i have seen, it seems to me that the mark can be as big
> as one Byte - is this correct ?
1 byte = 2^8 = 256.  I think it can be bigger.

> The next question is - is it possible to clear the statistical counters
> of "tc -s class .." back to zero ?
No.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] DSCP marking

2003-07-03 Thread sun reflex4
Hi,
I know that this question may NOT belong to this Mailing List, but 
nevertheless, I hope I will get some help :)

After having worked with DiffServ on Linux, I want now to try marking 
IP-packets in their DSCP header under Windows OS (e.g. WinXP). If somebody 
knows some information, plz tell me, and u can e-mail me 
[EMAIL PROTECTED]

Thanx in advance for ur understanding

_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: RE:RE:[LARTC] HTB Kernel log (cl && cl->un.leaf.q->q.qlen)

2003-07-03 Thread lartc
I don't understand what u meen!Can you explain more detailed please!I'm from
ROMANIA and my english it's a little poor!
What should I understand from this phrase "I have since moved over to a
different way of counting the packets so I no longer do this and the
messages stopped."
Thanx
- Original Message - 
From: "David Watson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 03 July, 2003 15:48 PM
Subject: Re: RE:RE:[LARTC] HTB Kernel log (cl && cl->un.leaf.q->q.qlen)


>
> On kernel 2.4.18 through 20 I could reproduce this by deleting my root
> qdiscs and re-creating them every minute. I have since moved over to a
> different way of counting the packets so I no longer do this and the
> messages stopped.
>
> At 13:02 03/07/2003 +0200, you wrote:
> >Ok, try please 2.4.21. Also can you trigger the bug
> >often or only sometimes ? Does it depend on traffic ?
> >I'm looking how to reproduce it here ..
>
> ___
> LARTC mailing list / [EMAIL PROTECTED]
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] What happened if the parent rate lower than children ?

2003-07-03 Thread [EMAIL PROTECTED]
Dear folks,
finally i found something weird after i foolishly try to lower parent rate.

i set parent class rate and ceil to 40kbit
while children rate i set to 10kbit and ceil to 100kbit

i check the statistic and i couldnt find parent details and rate, missing..
is this usual ? before i did this foolish thing, statistic for parent such
as rate is exist..

Help me analyze this ..

Regards,
Rio Martin.




mail2web - Check your email from the web at
http://mail2web.com/ .


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] tc and iptables --set-mark question

2003-07-03 Thread Joerg Hartmann
Hello,

if i mark packets on my firewall with "iptables" and "--set-mark" (lets 
say .. with --set-mark 0x12 ..) can someone tell me, WHERE in the 
resulting ip packet this data is stored ?
From the examples i have seen, it seems to me that the mark can be as big 
as one Byte - is this correct ?

The next question is - is it possible to clear the statistical counters 
of "tc -s class .." back to zero ? 

thanks and regards
Joerg
-- 
Jörg Hartmann   Tel: +49 391 40 00 125
[EMAIL PROTECTED]
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: RE:RE:[LARTC] HTB Kernel log (cl && cl->un.leaf.q->q.qlen)

2003-07-03 Thread David Watson
On kernel 2.4.18 through 20 I could reproduce this by deleting my root 
qdiscs and re-creating them every minute. I have since moved over to a 
different way of counting the packets so I no longer do this and the 
messages stopped.

At 13:02 03/07/2003 +0200, you wrote:
Ok, try please 2.4.21. Also can you trigger the bug
often or only sometimes ? Does it depend on traffic ?
I'm looking how to reproduce it here ..
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB Kernel log (cl && cl->un.leaf.q->q.qlen)

2003-07-03 Thread Stef Coene
On Thursday 03 July 2003 13:14, [EMAIL PROTECTED] wrote:
> yes I think it depends on traffic...
> but why this?
> PS
> 1) http://qos.dyndns.org:3389/cgi-bin/fom?file=40 what should I use on my
> K6 ??? default it's PSCHED_JIFFIES, i think!!
I'm not sure but if you do cat /proc/cpuinfo, do you seetsc in the flags?  I 
think that means your cpu has a timestamp counter.

> 2) http://qos.dyndns.org:3389/cgi-bin/fom?file=56 those filter destroy
> patches are applyed in 2.4.21 ??
Yes.

> 3) http://qos.dyndns.org:3389/cgi-bin/fom?file=21 What SFQ latency should I
> use?
> SFQ qdisc has a default queue length of 128 packets
Try the default sfq and see if that's enough.  If not, you can try to change 
the queue depth.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB burstable for 2 interface , how ?

2003-07-03 Thread Joel
Hi martin,

Lot of linux users are using imq. But i dont have time to use it.
But yes You can do one thing.

Your case

ethowan port  202.14.41.1

eth1 192.168.1.0/24
eth1:0---192.168.2.0/24

If you this 2 network connected within the same switch or hub then u can use
eth1 for both network if u have different switch or hub for this network
then y dont u put the cross cable between this two network and connect it
and then manage the bandwidth on both network.

give 192.168.1.0/24 bw 512
give 192.168.2.0/24 bw 512
and ceil it both to 512
and u know what u want to do ...when this network is not using the bandwidth
allow the other network.
its easy

u dont need to put the eth2 ..remove it...if u use the about example

Joel
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 03, 2003 1:56 AM
Subject: [LARTC] HTB burstable for 2 interface , how ?


Dear folks,
Here goes my bandwidth manager:

INTERNET
|
|eth0 202.14.41.1
BW.Manager
| |
| +eth1192.168.1.0/24
|
+--eth2192.168.2.0/24

Total incoming bandwidth to eth0 is 1024kbps
should be shared to eth1 and eth2, which mean each get 512Kbps and
burstable to 1024Kbps if other host is idle.

My question is how do i apply HTB to these situation ?
As far as i know eth1 and eth2 should be define as parent and cannot be as
children.

Regards,
Rio Martin.




mail2web - Check your email from the web at
http://mail2web.com/ .


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/




___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: RE:RE:[LARTC] HTB Kernel log (cl && cl->un.leaf.q->q.qlen)

2003-07-03 Thread lartc
yes I think it depends on traffic...
but why this?
PS
1) http://qos.dyndns.org:3389/cgi-bin/fom?file=40 what should I use on my K6
??? default it's PSCHED_JIFFIES, i think!!
2) http://qos.dyndns.org:3389/cgi-bin/fom?file=56 those filter destroy
patches are applyed in 2.4.21 ??
3) http://qos.dyndns.org:3389/cgi-bin/fom?file=21 What SFQ latency should I
use?
SFQ qdisc has a default queue length of 128 packets
Or shuld I use ESFQ...
Please advise me with this problems!!
Thank you




> Ok, try please 2.4.21. Also can you trigger the bug
> often or only sometimes ? Does it depend on traffic ?
> I'm looking how to reproduce it here ..

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: RE:RE:[LARTC] HTB Kernel log (cl && cl->un.leaf.q->q.qlen)

2003-07-03 Thread Martin Devera
Ok, try please 2.4.21. Also can you trigger the bug
often or only sometimes ? Does it depend on traffic ?
I'm looking how to reproduce it here ..

On Thu, 3 Jul 2003 [EMAIL PROTECTED] wrote:

> OK No problem!
> I'm useing Slack 9.0/2.4.20( AMD K6 2-333Mhz with RAM 128MB) with HTB from
> kernel...and U32 filters!
> /* How can I tweak bash or something ...to get high histoy on Shift+PageUP
> and a higher bashhistory, too */
> The dmesg paste:
> KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
> KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
> KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
> KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
> KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
> KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
> eth0: Promiscuous mode enabled.

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: RE:RE:[LARTC] HTB Kernel log (cl && cl->un.leaf.q->q.qlen)

2003-07-03 Thread lartc
OK No problem!
I'm useing Slack 9.0/2.4.20( AMD K6 2-333Mhz with RAM 128MB) with HTB from
kernel...and U32 filters!
/* How can I tweak bash or something ...to get high histoy on Shift+PageUP
and a higher bashhistory, too */
The dmesg paste:
KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
eth0: Promiscuous mode enabled.
device eth0 entered promiscuous mode
eth1: Promiscuous mode enabled.
device eth1 entered promiscuous mode
tcpdump uses obsolete (PF_INET,SOCK_PACKET)
eth0: Promiscuous mode enabled.
device eth0 left promiscuous mode
eth1: Promiscuous mode enabled.
device eth1 left promiscuous mode
htb*g j=1520405
htb*r7 m=0
htb*r6 m=0
htb*r5 m=0
htb*r4 m=0
htb*r3 m=0
htb*r2 m=0
htb*r1 m=0
htb*r0 m=0
htb*c10011 m=2 t=622399 c=622399 pq=0 df=761856 ql=0 pa=0 f:
htb*c10231 m=2 t=178505 c=13040 pq=0 df=6000 ql=0 pa=0 f:
htb*c10246 m=2 t=180741 c=12740 pq=0 df=49152 ql=0 pa=0 f:
htb*c10099 m=2 t=193067 c=13065 pq=0 df=4800512 ql=0 pa=0 f:
htb*c10001 m=2 t=-4595 c=-4595 pq=0 df=8192 ql=0 pa=0 f:
htb*c10230 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10247 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10222 m=2 t=17538 c=17538 pq=0 df=8192 ql=0 pa=0 f:
htb*c10002 m=2 t=-9823 c=-14019 pq=0 df=8192 ql=0 pa=0 f:
htb*c10233 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10244 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10102 m=2 t=184534 c=12840 pq=0 df=6000 ql=0 pa=0 f:
htb*c10232 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10254 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10105 m=2 t=183585 c=12815 pq=0 df=1204224 ql=0 pa=0 f:
htb*c10235 m=2 t=185483 c=12866 pq=0 df=19382272 ql=0 pa=0 f:
htb*c10242 m=2 t=192119 c=13040 pq=0 df=6000 ql=0 pa=0 f:
htb*c10253 m=2 t=178845 c=12690 pq=0 df=1187840 ql=0 pa=0 f:
htb*c10027 m=2 t=59392 c=59392 pq=0 df=6000 ql=0 pa=0 f:
htb*c10115 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10234 m=2 t=192119 c=13040 pq=0 df=6000 ql=0 pa=0 f:
htb*c10243 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10666 m=2 t=4209 c=4209 pq=0 df=106496 ql=0 pa=0 f:
htb*c10053 m=2 t=443199 c=443199 pq=0 df=6111232 ql=0 pa=0 f:
htb*c10006 m=2 t=168099 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10116 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10226 m=2 t=192119 c=13040 pq=0 df=6000 ql=0 pa=0 f:
htb*c10237 m=2 t=-44811 c=10740 pq=0 df=8192 ql=0 pa=0 f:
htb*c10240 m=2 t=178845 c=12690 pq=0 df=6000 ql=0 pa=0 f:
htb*c10106 m=2 t=192119 c=13040 pq=0 df=6000 ql=0 pa=0 f:
htb*c10227 m=2 t=192119 c=13040 pq=0 df=6000 ql=0 pa=0 f:
htb*c10236 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10241 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10250 m=2 t=-84557 c=8465 pq=0 df=8192 ql=0 pa=0 f:
htb*c10228 m=2 t=-7675 c=2917 pq=0 df=8192 ql=0 pa=0 f:
htb*c10239 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10229 m=2 t=-127349 c=8465 pq=0 df=8192 ql=0 pa=0 f:
htb*c10238 m=2 t=197807 c=13189 pq=0 df=6000 ql=0 pa=0 f:
htb*c10192 m=2 t=178845 c=12690 pq=0 df=1187840 ql=0 pa=0 f:
htb*c10248 m=2 t=186697 c=13040 pq=0 df=6000 ql=0 pa=0 f:
HTB init, kernel part version 3.7
htb*g j=1520407
htb*r7 m=0
htb*r6 m=0
htb*r5 m=0
htb*r4 m=0
htb*r3 m=0
htb*r2 m=0
htb*r1 m=0
htb*r0 m=0

My script for eth1 looks like this:

#!/bin/sh
TTRATE=2750kbit
TRATE=2048kbit

echo "delete!"
tc qdisc del dev eth1 root 2>/dev/null >/dev/null

echo "add qdisc..."
tc qdisc add dev eth1 root handle 1: htb default 99 r2q 2


#atention!!! sum(child rate) <= parent rates 
echo "add classes..."
tc class add dev eth1 parent 1: classid 1:1 htb rate $TTRATE ceil $TTRATE

#clasa www facuta de PALI !!!
tc class add dev eth1 parent 1: classid 1:666 htb rate 502kbit ceil 502kbit

#ssh class pt conexiuni intre calc din retea si server
tc class add dev eth1 parent 1: classid 1:222 htb rate 1024kbit ceil
1024kbit

#Counter Strike
tc class add dev eth1 parent 1: classid 1:27 htb rate 200Kbit ceil 200kbit

#ICMP class
tc class add dev eth1 parent 1: classid 1:11 htb rate 16kbit ceil 16kbit
#DNS class
tc class add dev eth1 parent 1: classid 1:53 htb rate 16kbit ceil 16kbit

#rdc class
tc class add dev eth1 parent 1:1 classid 1:6 htb rate 64Kbit ceil $TRATE
prio 1

#other parent
DOWN=1952 #640
tc class add dev eth1 parent 1:1 classid 1:2 htb rate $[DOWN]Kbit ceil
$TRATE prio 3

#badboys classes
N=32 #31 + 1(default) = 31(cu tot cu nerutabile)
RATE=$[(9*$DOWN)/(10*$N)]

echo "$[RATE]Kbit / class"
tc class add dev eth1 parent 1:2 classid 1:102 htb rate $[RATE]Kbit ceil
$TRATE prio 3 #192.168.10.2
tc class add dev eth1 p

RE:RE:[LARTC] HTB Kernel log (cl && cl->un.leaf.q->q.qlen)

2003-07-03 Thread Martin Devera
you should provide more info, version, script ..

On Thu, 3 Jul 2003 [EMAIL PROTECTED] wrote:

> Did someone solve this problem?
> I receive this error (on dmesg) when I launch my script for eth1:
>
> KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at sch_htb.c(959)
>
> Why ?

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


RE:RE:[LARTC] HTB Kernel log (cl && cl->un.leaf.q->q.qlen)

2003-07-03 Thread lartc




Did someone solve this problem?I receive this error (on dmesg) when I 
launch my script for eth1:
KERNEL: assertion (cl && cl->un.leaf.q->q.qlen) failed at 
sch_htb.c(959)
Why ?


[LARTC] Re: some can help out with u32 & TBF limitation < 2048 only

2003-07-03 Thread Trevor Warren
Thanks for the same martin. Am working on the same and will send the
results of the script back to the list.

Trevor


On Thu, 2003-07-03 at 13:42, devik wrote:
> I just looked into u32 source and sent
> mail to Alexey regarding some internals.
> But at this time I can observe some things:
> 
> 1) if you don't specify handle for u32 filter, new one will
>be assigned from NODE range (0-0x7ff)|0x800. Here you
>have 2048 limit probably.
> 
> 2) even with 2000 classes it will be slow as for each packet
>all 2000 filers are looked-up linearly.
> 
> To speed it up and make the range greater you need to use
> hashing ability of u32 (see divisor parameter). Then you
> can use last byte in IP as hash value and use up to 2048
> sub-filters per such byte.
> Thus you can simply extend range to 500.000 filters. If
> you assign some node ids manually then to 1.000.000.
> 
> I'd suggest you to use 2 level hash table instead. It will
> allow you to hash on 16bits of IP address (65.000 classes)
> and it will be 2000times faster than your current approach.
> See u32 manual (maybe on lartc?) on how to setup hash
> tables ...
> 
> I hope I didn't make mistake in my ideas - maybe Alexey
> will correct it.
> 
> ---
> Martin Devera aka devik
> Linux kernel QoS/HTB maintainer
>   http://luxik.cdi.cz/~devik/
> 
> On 2 Jul 2003, Trevor Warren wrote:
> 
> >
> > Hello Folks,
> >
> >  Some time ago i posted a mail on this list regarding the traffic
> > shaping script i devised based on htb and u32. The limitations of which
> > are 2048 filters + htb classes.
> >
> >  I am in a deep fix without a resolution for the same. HTB is really
> > cewl as it delivers on its functionality, but this lack of scalability
> > issue is a pain in me  cause of which some server deployments are on
> > hold.
> >
> >  Thanks in advance and would be glad to hear from anyone. The resolution
> > for the same when i find out i will post it on the mailing list.
> >
> > Trevor
> >
> >
> > --
> > ( >-LINUX, It's all about CHOICE  -< )
> > /~\__[EMAIL PROTECTED]   __   /~\
> > |  \) /  Pre Sales Consultant - Red Hat \ (/ |
> > |_|_  \9820349221(M) | 22881326(O)  / _|_|
> >\___/
> >
-- 
( >-LINUX, It's all about CHOICE  -< )
/~\__[EMAIL PROTECTED]   __   /~\
|  \) /  Pre Sales Consultant - Red Hat \ (/ |
|_|_  \9820349221(M) | 22881326(O)  / _|_|
   \___/

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB burstable for 2 interface , how ?

2003-07-03 Thread Stef Coene
On Thursday 03 July 2003 11:38, [EMAIL PROTECTED] wrote:
> It wont work..
> eth0 only for public ip traffic. It wont handle private network traffic.
> Traffic to private network can be manage through eth1 & eth2
>
> I guess the answer is IMQ .. i'll try ..
> Documentation please, or perhaps docum.org already have documentation
> regarding IMQ ?
Not much.  I never had the time to try imq my self.  But it's easy.  
With imq you can create virtual devices and you can redirect any traffic to 
with iptables.  So you can redirect all incoming traffic to eth0 to the 
virutal device.  Shaping the traffic can be done by adding a htb qdisc to the 
imq device.  But in your case you will have a filter problem because you 
don't know the src address when a packet enter eth0.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB burstable for 2 interface , how ?

2003-07-03 Thread [EMAIL PROTECTED]
It wont work..
eth0 only for public ip traffic. It wont handle private network traffic.
Traffic to private network can be manage through eth1 & eth2

I guess the answer is IMQ .. i'll try ..
Documentation please, or perhaps docum.org already have documentation
regarding IMQ ?

Regards,
Rio Martin.


Original Message:
-
From:  ? [EMAIL PROTECTED]

Well this can be done easily
You have to define a class having rate and ceiling 1024 kbps ( Kilobytes 
 if you want kilobits make its kbits ) in order not to exceed this limit.
Then you have to create two subclasses for the two networks by having as 
rate 512 and ceiling 1024. Then you must make the apropriate filters  
that will  classify the traffic in the right flows.
All theese for eth0.
So when the 192.168.1.0 is idle 192.168.2.0 will allocate all the 1024 
kbps bandwidth but when both will have traffic then they will take 512 each.




mail2web - Check your email from the web at
http://mail2web.com/ .


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] Re: some can help out with u32 & TBF limitation < 2048only

2003-07-03 Thread Trevor Warren
Hello Devik,
 
 This isn't an issue of htb as htb scales to > 2000 and i can vouch for
it. But a combination of U32 and htb ain't working for me. U32 works
>2000 with other QOS/Shaping algorithms.

 I have used tc as distributed by you and tested on kernel 2.4.21 &
2.4.20. 

 Where do you think the crux of the issue lies.

Trevor


On Thu, 2003-07-03 at 12:13, devik wrote:
> Hi,
> I can't test the script just now as I'm in important project (and
> don't want to crash my comp).
> What should I expect after running the script ?
> 
> In meantime you could change it and use 1 HTB class and 3000 u32
> filters pointing to the same class - the we will know where the
> limit is.
> 
> ---
> Martin Devera aka devik
> Linux kernel QoS/HTB maintainer
>   http://luxik.cdi.cz/~devik/
> 
> On 2 Jul 2003, Trevor Warren wrote:
> 
> >
> > Hello Folks,
> >
> >  Some time ago i posted a mail on this list regarding the traffic
> > shaping script i devised based on htb and u32. The limitations of which
> > are 2048 filters + htb classes.
> >
> >  I am in a deep fix without a resolution for the same. HTB is really
> > cewl as it delivers on its functionality, but this lack of scalability
> > issue is a pain in me  cause of which some server deployments are on
> > hold.
> >
> >  Thanks in advance and would be glad to hear from anyone. The resolution
> > for the same when i find out i will post it on the mailing list.
> >
> > Trevor
> >
> >
> > --
> > ( >-LINUX, It's all about CHOICE  -< )
> > /~\__[EMAIL PROTECTED]   __   /~\
> > |  \) /  Pre Sales Consultant - Red Hat \ (/ |
> > |_|_  \9820349221(M) | 22881326(O)  / _|_|
> >\___/
> >
> 
> ___
> LARTC mailing list / [EMAIL PROTECTED]
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
-- 
( >-LINUX, It's all about CHOICE  -< )
/~\__[EMAIL PROTECTED]   __   /~\
|  \) /  Pre Sales Consultant - Red Hat \ (/ |
|_|_  \9820349221(M) | 22881326(O)  / _|_|
   \___/

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB burstable for 2 interface , how ?

2003-07-03 Thread Martin Devera
you probably need IMQ if eth0 is input for your case

On Thu, 3 Jul 2003, [EMAIL PROTECTED] wrote:

> Dear folks,
> Here goes my bandwidth manager:
>
> INTERNET
> |
> |eth0 202.14.41.1
> BW.Manager
> | |
> | +eth1192.168.1.0/24
> |
> +--eth2192.168.2.0/24
>
> Total incoming bandwidth to eth0 is 1024kbps
> should be shared to eth1 and eth2, which mean each get 512Kbps and
> burstable to 1024Kbps if other host is idle.
>
> My question is how do i apply HTB to these situation ?
> As far as i know eth1 and eth2 should be define as parent and cannot be as
> children.
>
> Regards,
> Rio Martin.
>
>
>
> 
> mail2web - Check your email from the web at
> http://mail2web.com/ .
>
>
> ___
> LARTC mailing list / [EMAIL PROTECTED]
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
>
>
>

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB burstable for 2 interface , how ?

2003-07-03 Thread Stef Coene
On Thursday 03 July 2003 10:56, [EMAIL PROTECTED] wrote:
> Dear folks,
> Here goes my bandwidth manager:
>
> INTERNET
>
> |eth0 202.14.41.1
>
> BW.Manager
>
> | +eth1192.168.1.0/24
>
> +--eth2192.168.2.0/24
>
> Total incoming bandwidth to eth0 is 1024kbps
> should be shared to eth1 and eth2, which mean each get 512Kbps and
> burstable to 1024Kbps if other host is idle.
>
> My question is how do i apply HTB to these situation ?
> As far as i know eth1 and eth2 should be define as parent and cannot be as
> children.
Indeed.  What you can do is use imq and add a imq device to your eth0.  
Redirect all incoming traffic to it and a htb qdisc to the imq device.  
Create 2 classes : one for eth1 and one for eth2.  And voila, eth1 and eth2 
can share 1024 kbps.
You can have a problem splitting the traffic in the classes because you don't 
know the src address when the packets enters your shaper.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] HTB burstable for 2 interface , how ?

2003-07-03 Thread ???????? ?????
Well this can be done easily
You have to define a class having rate and ceiling 1024 kbps ( Kilobytes 
if you want kilobits make its kbits ) in order not to exceed this limit.
Then you have to create two subclasses for the two networks by having as 
rate 512 and ceiling 1024. Then you must make the apropriate filters  
that will  classify the traffic in the right flows.
All theese for eth0.
So when the 192.168.1.0 is idle 192.168.2.0 will allocate all the 1024 
kbps bandwidth but when both will have traffic then they will take 512 each.

[EMAIL PROTECTED] wrote:

Dear folks,
Here goes my bandwidth manager:
INTERNET
|
|eth0 202.14.41.1
BW.Manager
| |
| +eth1192.168.1.0/24
|
+--eth2192.168.2.0/24
Total incoming bandwidth to eth0 is 1024kbps
should be shared to eth1 and eth2, which mean each get 512Kbps and
burstable to 1024Kbps if other host is idle.
My question is how do i apply HTB to these situation ?
As far as i know eth1 and eth2 should be define as parent and cannot be as
children.
Regards,
Rio Martin.



mail2web - Check your email from the web at
http://mail2web.com/ .
___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
 



___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] HTB burstable for 2 interface , how ?

2003-07-03 Thread [EMAIL PROTECTED]
Dear folks,
Here goes my bandwidth manager:

INTERNET
|
|eth0 202.14.41.1
BW.Manager
| |
| +eth1192.168.1.0/24
|
+--eth2192.168.2.0/24

Total incoming bandwidth to eth0 is 1024kbps
should be shared to eth1 and eth2, which mean each get 512Kbps and
burstable to 1024Kbps if other host is idle.

My question is how do i apply HTB to these situation ?
As far as i know eth1 and eth2 should be define as parent and cannot be as
children.

Regards,
Rio Martin.




mail2web - Check your email from the web at
http://mail2web.com/ .


___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] HTB patch against 2.4.21

2003-07-03 Thread devik
Hi,

I've attached patch which is submitted for .22 and should fix
some dequeue-bug warnings. It is not critical but I'll be happy
if you test it.

---
Martin Devera aka devik
Linux kernel QoS/HTB maintainer
  http://luxik.cdi.cz/~devik/
--- linux-2.4.21/net/sched/sch_htb.cThu Jun 19 09:33:50 2003
+++ linux-2.4/net/sched/sch_htb.c   Wed Jun 18 21:57:07 2003
@@ -9,6 +9,8 @@
  * Authors:Martin Devera, <[EMAIL PROTECTED]>
  *
  * Credits (in time order) for older HTB versions:
+ *  Stef Coene <[EMAIL PROTECTED]>
+ * HTB support at LARTC mailing list
  * Ondrej Kraus, <[EMAIL PROTECTED]> 
  * found missing INIT_QDISC(htb)
  * Vladimir Smelhaus, Aamer Akhter, Bert Hubert
@@ -19,7 +21,7 @@
  * created test case so that I was able to fix nasty bug
  * and many others. thanks.
  *
- * $Id: sch_htb.c,v 1.17 2003/01/29 09:22:18 devik Exp devik $
+ * $Id: sch_htb.c,v 1.20 2003/06/18 19:55:49 devik Exp devik $
  */
 #include 
 #include 
@@ -71,7 +73,7 @@
 #define HTB_HYSTERESIS 1/* whether to use mode hysteresis for speedup */
 #define HTB_QLOCK(S) spin_lock_bh(&(S)->dev->queue_lock)
 #define HTB_QUNLOCK(S) spin_unlock_bh(&(S)->dev->queue_lock)
-#define HTB_VER 0x3000a/* major must be matched with number suplied by TC as 
version */
+#define HTB_VER 0x3000c/* major must be matched with number suplied by TC as 
version */
 
 #if HTB_VER >> 16 != TC_HTB_PROTOVER
 #error "Mismatched sch_htb.c and pkt_sch.h"
@@ -217,6 +219,9 @@
 /* time of nearest event per level (row) */
 unsigned long near_ev_cache[TC_HTB_MAXDEPTH];
 
+/* cached value of jiffies in dequeue */
+unsigned long jiffies;
+
 /* whether we hit non-work conserving class during this dequeue; we use */
 int nwc_hit;   /* this to disable mindelay complaint in dequeue */
 
@@ -336,7 +341,7 @@
 static void htb_debug_dump (struct htb_sched *q)
 {
int i,p;
-   printk(KERN_DEBUG "htb*g j=%lu\n",jiffies);
+   printk(KERN_DEBUG "htb*g j=%lu lj=%lu\n",jiffies,q->jiffies);
/* rows */
for (i=TC_HTB_MAXDEPTH-1;i>=0;i--) {
printk(KERN_DEBUG "htb*r%d m=%x",i,q->row_mask[i]);
@@ -419,8 +424,8 @@
if ((delay <= 0 || delay > cl->mbuffer) && net_ratelimit())
printk(KERN_ERR "HTB: suspicious delay in wait_tree d=%ld cl=%X 
h=%d\n",delay,cl->classid,debug_hint);
 #endif
-   cl->pq_key = jiffies + PSCHED_US2JIFFIE(delay);
-   if (cl->pq_key == jiffies)
+   cl->pq_key = q->jiffies + PSCHED_US2JIFFIE(delay);
+   if (cl->pq_key == q->jiffies)
cl->pq_key++;
 
/* update the nearest event cache */
@@ -598,7 +603,7 @@
 long toks;
 
 if ((toks = (cl->ctokens + *diff)) < (
-#ifdef HTB_HYSTERESIS
+#if HTB_HYSTERESIS
cl->cmode != HTB_CANT_SEND ? -cl->cbuffer :
 #endif
0)) {
@@ -606,7 +611,7 @@
return HTB_CANT_SEND;
 }
 if ((toks = (cl->tokens + *diff)) >= (
-#ifdef HTB_HYSTERESIS
+#if HTB_HYSTERESIS
cl->cmode == HTB_CAN_SEND ? -cl->buffer :
 #endif
0))
@@ -809,7 +814,7 @@
   cl->classid, diff,
   (unsigned long long) q->now,
   (unsigned long long) cl->t_c,
-  jiffies);
+  q->jiffies);
diff = 1000;
}
 #endif
@@ -852,6 +857,7 @@
  *
  * Scans event queue for pending events and applies them. Returns jiffies to
  * next pending event (0 for no event in pq).
+ * Note: Aplied are events whose have cl->pq_key <= jiffies.
  */
 static long htb_do_events(struct htb_sched *q,int level)
 {
@@ -866,9 +872,9 @@
while (p->rb_left) p = p->rb_left;
 
cl = rb_entry(p, struct htb_class, pq_node);
-   if (cl->pq_key - (jiffies+1) < 0x8000) {
-   HTB_DBG(8,3,"htb_do_ev_ret delay=%ld\n",cl->pq_key - jiffies);
-   return cl->pq_key - jiffies;
+   if (cl->pq_key - (q->jiffies+1) < 0x8000) {
+   HTB_DBG(8,3,"htb_do_ev_ret delay=%ld\n",cl->pq_key - 
q->jiffies);
+   return cl->pq_key - q->jiffies;
}
htb_safe_rb_erase(p,q->wait_pq+level);
diff = PSCHED_TDIFF_SAFE(q->now, cl->t_c, (u32)cl->mbuffer, 0);
@@ -879,7 +885,7 @@
   cl->classid, diff,
   (unsigned long long) q->now,
   (unsigned long long) cl->t_c,
-  jiffies);
+  q->jiffies);
diff = 1000;
}
 #endif
@@ -987,7 +993,8 @@
delay = 5*HZ;
}

[LARTC] Re: some can help out with u32 & TBF limitation < 2048 only

2003-07-03 Thread devik
I just looked into u32 source and sent
mail to Alexey regarding some internals.
But at this time I can observe some things:

1) if you don't specify handle for u32 filter, new one will
   be assigned from NODE range (0-0x7ff)|0x800. Here you
   have 2048 limit probably.

2) even with 2000 classes it will be slow as for each packet
   all 2000 filers are looked-up linearly.

To speed it up and make the range greater you need to use
hashing ability of u32 (see divisor parameter). Then you
can use last byte in IP as hash value and use up to 2048
sub-filters per such byte.
Thus you can simply extend range to 500.000 filters. If
you assign some node ids manually then to 1.000.000.

I'd suggest you to use 2 level hash table instead. It will
allow you to hash on 16bits of IP address (65.000 classes)
and it will be 2000times faster than your current approach.
See u32 manual (maybe on lartc?) on how to setup hash
tables ...

I hope I didn't make mistake in my ideas - maybe Alexey
will correct it.

---
Martin Devera aka devik
Linux kernel QoS/HTB maintainer
  http://luxik.cdi.cz/~devik/

On 2 Jul 2003, Trevor Warren wrote:

>
> Hello Folks,
>
>  Some time ago i posted a mail on this list regarding the traffic
> shaping script i devised based on htb and u32. The limitations of which
> are 2048 filters + htb classes.
>
>  I am in a deep fix without a resolution for the same. HTB is really
> cewl as it delivers on its functionality, but this lack of scalability
> issue is a pain in me  cause of which some server deployments are on
> hold.
>
>  Thanks in advance and would be glad to hear from anyone. The resolution
> for the same when i find out i will post it on the mailing list.
>
> Trevor
>
>
> --
> ( >-LINUX, It's all about CHOICE  -< )
> /~\__[EMAIL PROTECTED]   __   /~\
> |  \) /  Pre Sales Consultant - Red Hat \ (/ |
> |_|_  \9820349221(M) | 22881326(O)  / _|_|
>\___/
>

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] imq + htb =~/kazaa/

2003-07-03 Thread Stef Coene
On Thursday 03 July 2003 07:45,  ? wrote:
> In my shaper I run htb on a bridge. I shape with success the kazaa and
> winmx traffic. As about Kazaa you have to place filters for tcp port
> 1214 and it will work fine.
Or try the layer 7 filter patch for the kernel (but I think it's only released 
for the 2.5.xx kernels).  So you can filter on packet content and you can 
filter all kazaa traffic no mather the ports they are using.

Stef

-- 

[EMAIL PROTECTED]
 "Using Linux as bandwidth manager"
 http://www.docum.org/
 #lartc @ irc.oftc.net

___
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/