[LARTC] htb statistics

2007-10-01 Thread Gerrit Brehmer
Hi,

how long is the period over that the htb rate of a class will be estimated? on 
a site i read 10 sec but the update rate is 10 sec. i think the average rate 
determination is nearly 120 seconds?
What is the exact meaning of requeues? If one packet must be 5 times requeued 
this statistics value is 5? When will be a packet requeued because in my case 
this value is always 0...
Is overlimits a summary of dropped, requeued and delayed packets, because all 
dropped or requeued packets were previously marked as overlimit?
I have a htb root qdisc,three htb classes, and two leaf-sfq-qdiscs. The root 
class will shaping the traffic to 512kbit. So i meant that the overlimits value 
of this class will be increased if someone would send the data faster. but the 
overlimits will be counted only in the root htb qdisc. is there a reason for 
this behauvior?

Thanks in advance for your help!
Gerrit


   

Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/
___
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc


[LARTC] download/upload restriction.

2007-10-01 Thread Umesh Upreti
Hi all I have following script in my server. Now I want to restrict ip
192.168.3.2 to 128kbps (downlink). But in this case client can download upto
500kbps and upload cannot exceed more than 20kbps. Now what should I do to
restrict client 192.168.3.2 within 128kbps downlink and 64kbps uplink.

 

 

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1:0 htb
tc class add dev eth0 parent 1:0 classid 1:1  htb rate 300kbit
tc class add dev eth0 parent 1:0 classid 1:11 htb rate 128kbit ceil 300kbit
tc class add dev eth0 parent 1:0 classid 1:12 htb rate 128kbit ceil 300kbit
tc class add dev eth0 parent 1:0 classid 1:13 htb rate 50kbit ceil 300kbit
tc qdisc add dev eth0 parent 1:11 handle 210: pfifo limit 10
tc qdisc add dev eth0 parent 1:12 handle 220: pfifo limit 10
tc qdisc add dev eth0 parent 1:13 handle 230: pfifo limit 10
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dst
192.168.3.1 match ip sport 20 0xfff flowid 1:11
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dst
192.168.3.1 match ip sport 21 0xfff flowid 1:11
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dst
192.168.3.2  flowid 1:12
tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 match ip dst
192.168.3.3 flowid 1:13

 

Regards, 

Umesh

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


PHP script to get MySQL data and make TC speed limit Re: [LARTC] (no subject)

2007-10-01 Thread nic-lartc

Dear Anirudh,

You will probably get better help if you write your setup, what you have 
tried, how it does not work, and write a subject.


Here is a PHP script which looks IP numbers and limits up in a database 
and generates a simple TC HTB limit rule per host.


You may be able to modify it to be useful for you.

Notes:

- This script is run from the console, not a web server. You will need 
command line PHP installed. Or you can rewrite it in a language of your 
choice.


- We only have two limit options: limit everything to 255 Kbit/s, or 
limit only packets that have been marked as "6" by some firewall rules 
to 255 Kbit/s. You will want to rewrite this bit to get the speed value 
from the database, but you can simplify the "marked as 6" bit away.


- Warning: we only limit download speed. You will probably want to limit 
upload speed as well! You will probably want to do this by matching on 
IP number on the way OUT of you INTERNET interface.



#!/usr/bin/php
$sql_query = "SELECT mac, last_seen_ip, `limit` FROM mac_info WHERE 
`limit` > 0 AND expiry_date > NOW()";

$result = mysql_query($sql_query)
   or die(mysql_error());

$i = 1;

while ($current_row = mysql_fetch_assoc($result)) {

   $ip = $current_row['last_seen_ip'];
   $limit = $current_row['limit'];
   $mac = $current_row['mac'];

   if (check_internal_ip($ip)) {

   $out .= sprintf($cmd1,$i,$mac,$i);

   if ($limit == 1)
   $out .= sprintf($cmd2dkstream,$ip,$i);
   elseif ($limit == 2)
   $out .= sprintf($cmd2all,$ip,$i);

   $i++;
   }
   unset($ip); unset($limit); unset($mac);
}


if($debug)
   print $out;
else
   logfile($out);
   `$out`; // run everything in 'out'

?>
---
The output looks like this:


# delete all existing queue disciplines
tc qdisc del dev eth2 root

# attach queue discipline HTB to interface eth2 and give it handle 1:0
tc qdisc add dev eth2 root handle 1:0 htb

# host 1 mac x
tc class add dev eth2 parent 1:0 classid 1:1 htb rate 255kbit burst 255kbit
tc filter add dev eth2 protocol ip parent 1:0 prio 1 u32 \
   match ip dst 172.16.xxx.xxx \
   flowid 1:1

# host 2 mac 
tc class add dev eth2 parent 1:0 classid 1:2 htb rate 255kbit burst 255kbit
tc filter add dev eth2 protocol ip parent 1:0 prio 1 u32 \
   match mark 0x0006 0x \
   match ip dst 172.16.xxx.xxx \
   flowid 1:2

--


Anirudh Gottumukkala)me in Google Accounts (Anirudh Gottumukkala wrote:

Hello

I am anirudh, I need help to write script to fetch detail like ips, 
speedlimit  from mysql and add htb rules at the starting of the 
server. it is for a small isp i am working for.


can any one help me out!, i had tried but fail to limit speed

--
Anirudh Chowdary


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


[LARTC] Problem with Julian Anastasov's routing patches

2007-10-01 Thread François Delawarde

Hello,

I wanted to try some multipath setup with Julian's patches, and when 
rebooting on the newly patched kernel, without any multipath routes 
(only one interface up and one default gateway), my SSH connections to 
the server freeze after a few seconds. I tried with and without bridges 
(I sometimes have a bridge between a tap device and my eth0) with the 
same results.


When I close and try to reconnect, sometimes it works, sometimes it 
doesn't, but when it does the client (on my laptop) always stops 
receiving data from the server after a random time, between 1 and 60 
seconds approximately. Also HTTP connections to the server's apache 
daemon seem to suffer from this problem, and I usually have to "reload" 
the page from my browser several times in order to have a complete page 
(it usually stops in the middle of the page loading).


Tracing with tcpdump on the laptop, the connections seem still up (the 
server sends ACK packets, and when closing the console on the laptop, I 
can see the FIN stuff closing TCP connection successfully), but the ssh 
console is frozen on the laptop (no real replies from server apart from 
ACK).


I tested several times with and without the patches, and it strongly 
appears to be related to Julian's patches.

- Is it a known issue for these kernels (2.6.21)?
- Is there a way to repair that in order to be able to use these patches?

I'm using a vanilla kernel 2.6.21.7 with the following patches:
- IMQ
- Layer 7
- Julian's route patches (version for kernel 2.6.21)

relevant parts of .config:
CONFIG_IP_ROUTE_MULTIPATH=y
# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set
...
# CONFIG_BRIDGE_NETFILTER is not set
# CONFIG_BRIDGE_NF_EBTABLES is not set
CONFIG_BRIDGE=m

Thanks for any help,
François.
___
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc