On Tuesday 29 July 2003 10:21, Rio Martin. wrote: > On Tuesday 29 July 2003 14:45, you wrote: > > > tc qdisc add dev eth0 root handle 1 htb default 0 r2q 10 > > > > Bad idea. Class 0 is a special one and I dont't think you want > > unclassified traffic go out at full speed .... > > That because i dont want to shape my ssh connection & other connection from > my pc to bandwidth.limiter (: Then it's better to create a separate class for it and put your ssh traffic in it. > I am still learning about fw mark to shape both incoming and outgoing > bandwidth from my network. Incoming traffic can be tricky. You need the imq device or a dedicated shaper for it so you can shape on 2 nic's. > Please let me know how to shape incoming rate with Iptables fw mark > I ve done with the outgoing bandwidth but i still dont understand how to > mark incoming bandwidth from my ISP. > example: > > /usr/sbin/iptables -t mangle -A POSTROUTING -s 192.168.1.0/24 -j MARK > --set-mark 100 > this is for upgoing connection from my local network. > > tc class add dev eth0 parent 1: classid 1:100 htb rate 40Kbit ceil 40Kbit > tc qdisc add dev eth0 parent 1:100 handle 100 sfq perturb 10 quantum 1500 > tc filter add dev eth0 parent 1:0 protocol ip prio 200 handle 100 fw > classid 1:100 The problem is not marking with iptables, but shaping. If you add something to nic eth0, you shape outgoing packets for that nic. You can not do this for incoming packets. What you can do is use imq. This is a virutal device and you can redirect incoming packets to it. And you can add a htb qdisc to it .... Or you have to use filters + policers, but that's not powerful. > > Argh. Remove the burst and cburst parameters so htb can calculate the > > smalles one for you. I think that's your problem. > > if i remove those parameters, it will exceed about 4 - 5 Kbit > if i use those parameters, it only exceed about 40-80 bit (: The exceed is normal. Traffic is bursty and you can not expect to shape it perfectly. > About my ISP, > Downstream connection is burstable. I get CIR 512Kbps burstable to 1024Kbps > Please advise how to deal this situation Stef, Then you have a problem. You can not configure this with htb because you don't know the ISP bandwidth. However, you can create a setup for 1024 kbps. You will loose some precision because you are not the bottleneck anymore, but you will able to shape your link. Stef -- stef.coene@xxxxxxxxx "Using Linux as bandwidth manager" http://www.docum.org/ #lartc @ irc.oftc.net