[LARTC] greb + htb debug

2005-01-24 Thread Alaios
Good morning i want to enable some debug messages
concering htb and gred. The reason is that i want to
see the journey of the ip packet through the 2.6
kernel from the start to finish (ethernet interface up
to htb and gred classification).

In the sch_htc.c i have found the following

/* debugging support; S is subsystem, these are
defined:
  0 - netlink messages
  1 - enqueue
  2 - drop  requeue
  3 - dequeue main
  4 - dequeue one prio DRR part
  5 - dequeue class accounting
  6 - class overlimit status computation
  7 - hint tree
  8 - event queue
 10 - rate estimator
 11 - classifier
 12 - fast dequeue cache

 L is level; 0 = none, 1 = basic info, 2 = detailed, 3
= full
 q-debug uint32 contains 16 2-bit fields one for
subsystem starting
 from LSB
 */
#ifdef HTB_DEBUG
#define HTB_DBG_COND(S,L) (((q-debug(2*S))3) = L)
#define HTB_DBG(S,L,FMT,ARG...) if (HTB_DBG_COND(S,L))
\

but still i don't know what should i change in order
to see debug messages in my dmesg...

Also in the same file the following line exists
#define HTB_DEBUG 1 /* compile debugging support
(activated by tc tool) */

Do u know how i can use tc tool for viewing that debug
messages?
Thx a lot





__ 
Do you Yahoo!? 
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] tc filter change/replace

2005-01-24 Thread Antonios Chalkiopoulos

I am wondering whether the commands 'tc filter change' and 'tc filter replace' 
are working. Googling around revealed a few emails on the LARTC stating that 
unfoirtunately they do not work. A quick check showed that they are still not 
implemented (properly).
Some propose a solution to build a second tree of filters and apply the 2nd 
one when a need for it arises. Howver how can someone achive the above trick.

Any answer is welcomew.

Thanks, Antonio  Alex
___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] Htb, imq and sfq traffic shaping

2005-01-24 Thread Ixen Gerthannes
Hello,
I wrote a simple traffic shaping script (below) that should have allowed me to 
shape my internet traffic a bit (ppp0 - adsl 128kbit/64kbit; local interface 
eth0).
The script works only partially - the speed is being limited but too much. 
Without running this script my download rate is about 10kBytes (with second 
computer also downloading at about 6kBytes). After running it my download speed 
decreases to about 1..2kBytes and so the second computer.
Could you tell me what have I done wrong ?

Thank you for replies.
Ixen

--
My configuration:
Celeron 450MHz, 256MB RAM
Kernel 2.6.9 patched for imq support (imq devices compiled into kernel)
iptables 1.2.11 (also patched for imq)

Script:
#!/bin/sh

DOWNIF='imq0'
UPIF='imq1'
rc_done=  done
rc_failed=  failed

TC='/sbin/tc'
IPTABLES='/usr/sbin/iptables'
IFCONFIG='/sbin/ifconfig'
MODPROBE='/sbin/modprobe'

return=$rc_done

tc_reset ()
{
# remove old devices if any
echo Removing old root qdisc...
$TC qdisc del dev $DOWNIF root
$TC qdisc del dev $UPIF root
}

tc_status ()
{
echo 
echo [qdisc - $DOWNIF]
$TC -s qdisc show dev $DOWNIF
echo [qdisc - $UPIF]
$TC -s qdisc show dev $UPIF
echo 
echo
echo [class - $DOWNIF]
$TC -s class show dev $DOWNIF
echo [class - $UPIF]
$TC -s class show dev $UPIF
}

tc_showfilter ()
{
echo [filter - $DOWNIF]
$TC -s filter show dev $DOWNIF
echo [filter - $UPIF]
$TC -s filter show dev $UPIF
}

case $1 in

start)
echo Starting traffic shaping...
tc_reset

# setup imq devices - imq0 for download, imq1 for upload
#$MODPROBE imq numdevs 2

$IFCONFIG imq0 up
$IFCONFIG imq1 up

# ROOT DEVICE
echo   Setting root devices for $DOWNIF and $UPIF

# download
$TC qdisc add dev $DOWNIF root handle 1: htb default 99
$TC qdisc add dev $DOWNIF parent 1: classid 1:10 htb rate 128kbit
# upload
$TC qdisc add dev $UPIF root handle 1: htb default 98
$TC class add dev $UPIF parent 1: classid 1:20 htb rate 64kbit

# ADDRESSES
echo   192.168.0.30
# 192.168.0.30
$TC class add dev $DOWNIF parent 1:10 classid 1:1000 htb rate 48kbit ceil 
128kbit
$TC qdisc add dev $DOWNIF parent 1:1000 handle 1000 sfq
$TC filter add dev $DOWNIF parent 1:0 protocol ip prio 200 handle 1000 fw 
classid 1:1000

$TC class add dev $UPIF parent 1:20 classid 1:2000 htb rate 24kbit ceil 
64kbit
$TC qdisc add dev $UPIF parent 1:2000 handle 2000 sfq
$TC filter add dev $UPIF parent 1:0 protocol ip prio 200 handle 2000 fw 
classid 1:2000

$IPTABLES -t mangle -A POSTROUTING -d 192.168.0.30 -j MARK --set-mark 1000
$IPTABLES -t mangle -A POSTROUTING -s 192.168.0.30 -j MARK --set-mark 2000

# 192.168.0.178
echo   192.168.0.178
$TC class add dev $DOWNIF parent 1:10 classid 1:1010 htb rate 16kbit ceil 
100kbit
$TC qdisc add dev $DOWNIF parent 1:1010 handle 1010 sfq
$TC filter add dev $DOWNIF parent 1:0 protocol ip prio 200 handle 1010 fw 
classid 1:1010

$TC class add dev $UPIF parent 1:20 classid 1:2010 htb rate 8kbit ceil 
60kbit
$TC qdisc add dev $UPIF parent 1:2010 handle 2010 sfq
$TC filter add dev $UPIF parent 1:0 protocol ip prio 200 handle 2010 fw 
classid 1:2010

$IPTABLES -t mangle -A POSTROUTING -d 192.168.0.178 -j MARK --set-mark 1010
$IPTABLES -t mangle -A POSTROUTING -s 192.168.0.178 -j MARK --set-mark 2010

# 192.168.0.55
echo   192.168.0.55
$TC class add dev $DOWNIF parent 1:10 classid 1:1020 htb rate 16kbit ceil 
100kbit
$TC qdisc add dev $DOWNIF parent 1:1020 handle 1020 sfq
$TC filter add dev $DOWNIF parent 1:0 protocol ip prio 200 handle 1020 fw 
classid 1:1020

$TC class add dev $UPIF parent 1:20 classid 1:2020 htb rate 8kbit ceil 
60kbit
$TC qdisc add dev $UPIF parent 1:2020 handle 2020 sfq
$TC filter add dev $UPIF parent 1:0 protocol ip prio 200 handle 2020 fw 
classid 1:2020

$IPTABLES -t mangle -A POSTROUTING -d 192.168.0.55 -j MARK --set-mark 1020
$IPTABLES -t mangle -A POSTROUTING -s 192.168.0.55 -j MARK --set-mark 2020

# other
echo   other...
$TC class add dev $DOWNIF parent 1:10 classid 1:99 htb rate 100bit ceil 
8kbit
$TC class add dev $UPIF parent 1:20 classid 1:98 htb rate 100bit ceil 8kbit

# route traffic
echo   Traffic redirecting
# download
$IPTABLES -t mangle -A POSTROUTING -d 192.168.0.0/24 -j IMQ --todev 0
#upload
$IPTABLES -t mangle -A POSTROUTING -s 192.168.0.0/24 -j IMQ --todev 1

tc_status
;;


stop)
echo -n Stopping traffic shaper...
tc_reset || return=$rc_failed
echo -e $return
;;


Re: [LARTC] Htb, imq and sfq traffic shaping

2005-01-24 Thread George Alexandru Dragoi
I didn't look much on your script (my brain is not that good
compiler), but looking at yoour default classes and what is happening
with you, i think the filters are not working on you, and evetything
go to default classes. If so, removing the default classes will make
everything work at maximum speed.


On Mon, 24 Jan 2005 15:08:57 +0100, Ixen Gerthannes [EMAIL PROTECTED] wrote:
 Hello,
 I wrote a simple traffic shaping script (below) that should have allowed me 
 to shape my internet traffic a bit (ppp0 - adsl 128kbit/64kbit; local 
 interface eth0).
 The script works only partially - the speed is being limited but too much. 
 Without running this script my download rate is about 10kBytes (with second 
 computer also downloading at about 6kBytes). After running it my download 
 speed decreases to about 1..2kBytes and so the second computer.
 Could you tell me what have I done wrong ?
 
 Thank you for replies.
 Ixen
 
 --
 My configuration:
 Celeron 450MHz, 256MB RAM
 Kernel 2.6.9 patched for imq support (imq devices compiled into kernel)
 iptables 1.2.11 (also patched for imq)
 
 Script:
 #!/bin/sh
 
 DOWNIF='imq0'
 UPIF='imq1'
 rc_done=  done
 rc_failed=  failed
 
 TC='/sbin/tc'
 IPTABLES='/usr/sbin/iptables'
 IFCONFIG='/sbin/ifconfig'
 MODPROBE='/sbin/modprobe'
 
 return=$rc_done
 
 tc_reset ()
 {
 # remove old devices if any
 echo Removing old root qdisc...
 $TC qdisc del dev $DOWNIF root
 $TC qdisc del dev $UPIF root
 }
 
 tc_status ()
 {
 echo 
 echo [qdisc - $DOWNIF]
 $TC -s qdisc show dev $DOWNIF
 echo [qdisc - $UPIF]
 $TC -s qdisc show dev $UPIF
 echo 
 echo
 echo [class - $DOWNIF]
 $TC -s class show dev $DOWNIF
 echo [class - $UPIF]
 $TC -s class show dev $UPIF
 }
 
 tc_showfilter ()
 {
 echo [filter - $DOWNIF]
 $TC -s filter show dev $DOWNIF
 echo [filter - $UPIF]
 $TC -s filter show dev $UPIF
 }
 
 case $1 in
 
 start)
 echo Starting traffic shaping...
 tc_reset
 
 # setup imq devices - imq0 for download, imq1 for upload
 #$MODPROBE imq numdevs 2
 
 $IFCONFIG imq0 up
 $IFCONFIG imq1 up
 
 # ROOT DEVICE
 echo   Setting root devices for $DOWNIF and $UPIF
 
 # download
 $TC qdisc add dev $DOWNIF root handle 1: htb default 99
 $TC qdisc add dev $DOWNIF parent 1: classid 1:10 htb rate 128kbit
 # upload
 $TC qdisc add dev $UPIF root handle 1: htb default 98
 $TC class add dev $UPIF parent 1: classid 1:20 htb rate 64kbit
 
 # ADDRESSES
 echo   192.168.0.30
 # 192.168.0.30
 $TC class add dev $DOWNIF parent 1:10 classid 1:1000 htb rate 48kbit ceil 
 128kbit
 $TC qdisc add dev $DOWNIF parent 1:1000 handle 1000 sfq
 $TC filter add dev $DOWNIF parent 1:0 protocol ip prio 200 handle 1000 fw 
 classid 1:1000
 
 $TC class add dev $UPIF parent 1:20 classid 1:2000 htb rate 24kbit ceil 
 64kbit
 $TC qdisc add dev $UPIF parent 1:2000 handle 2000 sfq
 $TC filter add dev $UPIF parent 1:0 protocol ip prio 200 handle 2000 fw 
 classid 1:2000
 
 $IPTABLES -t mangle -A POSTROUTING -d 192.168.0.30 -j MARK --set-mark 1000
 $IPTABLES -t mangle -A POSTROUTING -s 192.168.0.30 -j MARK --set-mark 2000
 
 # 192.168.0.178
 echo   192.168.0.178
 $TC class add dev $DOWNIF parent 1:10 classid 1:1010 htb rate 16kbit ceil 
 100kbit
 $TC qdisc add dev $DOWNIF parent 1:1010 handle 1010 sfq
 $TC filter add dev $DOWNIF parent 1:0 protocol ip prio 200 handle 1010 fw 
 classid 1:1010
 
 $TC class add dev $UPIF parent 1:20 classid 1:2010 htb rate 8kbit ceil 
 60kbit
 $TC qdisc add dev $UPIF parent 1:2010 handle 2010 sfq
 $TC filter add dev $UPIF parent 1:0 protocol ip prio 200 handle 2010 fw 
 classid 1:2010
 
 $IPTABLES -t mangle -A POSTROUTING -d 192.168.0.178 -j MARK --set-mark 
 1010
 $IPTABLES -t mangle -A POSTROUTING -s 192.168.0.178 -j MARK --set-mark 
 2010
 
 # 192.168.0.55
 echo   192.168.0.55
 $TC class add dev $DOWNIF parent 1:10 classid 1:1020 htb rate 16kbit ceil 
 100kbit
 $TC qdisc add dev $DOWNIF parent 1:1020 handle 1020 sfq
 $TC filter add dev $DOWNIF parent 1:0 protocol ip prio 200 handle 1020 fw 
 classid 1:1020
 
 $TC class add dev $UPIF parent 1:20 classid 1:2020 htb rate 8kbit ceil 
 60kbit
 $TC qdisc add dev $UPIF parent 1:2020 handle 2020 sfq
 $TC filter add dev $UPIF parent 1:0 protocol ip prio 200 handle 2020 fw 
 classid 1:2020
 
 $IPTABLES -t mangle -A POSTROUTING -d 192.168.0.55 -j MARK --set-mark 1020
 $IPTABLES -t mangle -A POSTROUTING -s 192.168.0.55 -j MARK --set-mark 2020
 
 # other
 echo   other...
 $TC class add dev $DOWNIF parent 1:10 classid 1:99 htb rate 100bit ceil 
 8kbit
 $TC class add dev $UPIF parent 1:20 classid 1:98 htb rate 100bit ceil 
 8kbit
 
 # route traffic
 echo   Traffic redirecting
 # 

Re: [LARTC] network emulation

2005-01-24 Thread Stephen Hemminger
On Sat, 22 Jan 2005 05:46:19 -0800 (PST)
vinay mathew [EMAIL PROTECTED] wrote:

 hi,
 I am really a newbie in linux traffic control.But i have task to implement a 
 tool similar to 
 the nistnet tool used for netwok emulation tests but which emulates a 
 wireless environment. 
 I was exploring the use of the traffic control subsystem for this task.In 
 this regard i have 
 a few questions i need to post in order to clarify my thoughts on how to do 
 this.I am using 
 tcng to classify traffic and generate the commands necessary to set up the 
 traffic control 
 structures.
  
 1. A simple task to add say a delay of 10ms to packets goin to a particular 
 destination.I 
 tried this using a simple fifo queue and a tbf queue but was not able to 
 obtain the required 
 results.The queue parameters dont have an explicit delay/latency parameter so 
 basically i 
 want to know how to add a delay/latency to packets goin out thro a particular 
 interface.
 A simple script that i tried


Use netem (http://developer.osdl.org/shemminger/netem)
it is already in 2.6.8

  
 2.The second part is similar to the first but involves dropping a percentage 
 of packets 
 instead of adding a delay to them.Example i need a 10% packet drop for 
 packets coming from 
 source 1 and heading to dest 2. Example i use a simple fifo queue with a 
 limit of 2 kB in 
 order to just test random drop capability.When i use the ping utility with a 
 packet size 
 greater than 2kB i get the message that 0 packets sent and 0 packets received 
 and when the 
 packet sizes are  2048 bytes then there is no drop or delay at all.Ne ideas 
 on this one.

ditto

 3.To implement bandwidth sharing among different hosts.Example 4 hosts are 
 communicating to each other and all traffic between them is routed through a 
 router which is like the 
 bottleneck and acts as the wireless network environment with the bottleneck 
 capacity as the 
 known wireless link capacity.I was thinking and am currently trying this 
 using the HTB 
 queuing discipline.I wanted to know if this idea can be effectively 
 implemented using the 
 HTB queuing discipline.
 
 Also im having some problems with installation and working of tcng on my Suse 
 9.2 system 
 which is running with a 2.6.8 kernel version.Ok the simulator could not be 
 compiled. But 
 when i tried using the commands generated by the tcng compiler i get the 
 error that dsmark 
 queuing discipline is not supported.However when i use the root keyword using 
 the tc tool there seems to be no problem.I read that root and dsmark are the 
 same ...or am i wrong about this. Also my kernel has all the parameters 
 enabled for QoS support.I tried compiling iproute2 from source but im not 
 able to since im getting errors while compiling.Can neone throw some light on 
 this.Or is it that there are some compatibility problems with the newer 2.6 
 kernels.
 Im sorry for the long content of the mail.But im a newbie and want to get my 
 thoughts rite 
 on this and whether its possible.Thanx a million in advance.
 regards
 vinay


Tcng depends on tclsim as part of the build process but it doesn't seem to 
build on 2.6.

 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 

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


Re: [LARTC] Layer 7 packet classifier doesn't recognize packets sent by the router itself

2005-01-24 Thread FB
Thanks!
Now it works :)
But I have another little problem: I need 2(3) different chains (one for 
traffic only from the router (done by this chain), one for the complete 
traffic generatet from router AND computers behind the router and one 
for connections only established from computers behind the router).

Any ideas how to accomplish that?
-FB
George Alexandru Dragoi wrote:
Try this
iptables -t mangle -N local
iptablts -t mangle -A INPUT -i $INET_IFACE -j local
iptables -t mangle -A OUTPUT -o $INET_IFACE -j local
iptables -t mangle -A local -p tcp -m layer7 --l7proto http -j DROP
I only think it may work, i say this because local packets are passing
INPUT and OUTPUT, while routed packets will always pass POSTROUTING
(and l7-filter need to make a match both ways: incoming and outgoing
packets)
___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] tc filter change/replace

2005-01-24 Thread Thomas Graf
* Antonios Chalkiopoulos [EMAIL PROTECTED] 2005-01-24 14:02
 
 I am wondering whether the commands 'tc filter change' and 'tc filter 
 replace' 
 are working. Googling around revealed a few emails on the LARTC stating that 
 unfoirtunately they do not work. A quick check showed that they are still not 
 implemented (properly).
 Some propose a solution to build a second tree of filters and apply the 2nd 
 one when a need for it arises. Howver how can someone achive the above trick.

All classifiers except rsvp are changeable in the latest bk. The
patchset has gone in around rc1-bk3-5.
___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


Re: [LARTC] Info about VoiP Qos

2005-01-24 Thread Ed Wildgoose

But i would like to have the possibility to use all the 400Kbps and slow
down server traffic only when and if needed.
I prioritized VoIP traffic, using the various scripts around, and what i
get is that, even if voip quality is definitely much much better than
without shaping, there are is still statics and pops, and some
interruption of the voice and only if i'm called from POTS
I do not get this when completely reserving the bandwith or when the
link is not loaded.

You probably forgot to tweak the HTB code to change the hysterisis value?
This helps a lot with the output stuff.  However, remember that you 
always have to slow down the incoming to a little less than max 
otherwise by the time the stuff is throttled you see some small amount 
of queuing at the remote end.

Also remember that the bandwidth of most adsl links is less than the 
stated bandwidth.  This is because of ATM overheads (which vary 
depending on packet size) and also because the link is contended.

Put this all together and you should be able to get pretty close to 
maximum,. perhaps only reserving a small amount of bandwidth and make 
the rest shareable.

Good luck
Ed W
___
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/


[LARTC] [ANNOUNCE] iproute2 (050124) release

2005-01-24 Thread Stephen Hemminger
Thanks to the work of Jamal and Thomas; here is an update to iproute2.

http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.10-ss050124.tar.gz

Changes since last version:
[Yun Mao]
 fix typo in ss

[Thomas Graf]
tc pedit/action cleanups
add addraw_l
rtattr_parse cleanups

[Jamal Hadi Salim]
typo in m_mirred
add support for pedit

[Jim Gifford]
 Fix allocation size error in nomal and paretonormal generation
 programs.

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