On 9/20/05, Clemens Eisserer <[EMAIL PROTECTED]> wrote: > Does really nobody know wether this does not work? > Should it work theoretically? > > Maybe you could point me where tc/tcng-experienced people are - I do > not want to nerve with this topic since its of course on topic on the > debian users list ;-) > > Thanks for your patience, lg Clemens > > 2005/9/20, Clemens Eisserer <[EMAIL PROTECTED]>: > > Hi there, > > > > I use a old P90 for routing our LAN into the internet, however > > sometimes I want to download large binaries to the server itself which > > may not slow down the internet-connection of the PCs in the LAN. > > > > I wrote a small tcng-skript which should do the trick - basically > > assign all available bandwith tho the two end-user pcs in the LAN > > (user1, user2) - and only very little minium bandwith to the server > > itself (user3). > > However if I start to download an iso on the server using wget > > browsing is almost impossible on the LAN pcs at all :-( > > Any ideas what could be wrong, since I am very new to tcng it could be > > easily that I made mistakes or misunderstood something. > > Btw. I route the two PCs into the internet doing NAT via iptables. > > > > Please help, I already tried days to slove it myself but I simply was > > not able to find the problem :-( > > > > Thank you in advance, lg Clemens > > > > The tcng-"source": > > > > #include "fields.tc" > > #include "ports.tc" > > $INTERFACE="ippp0"; > > $MAX=75kbps; > > $RATE_USER1=60kbps; > > $RATE_USER2=12kbps; > > $RATE_USER3=3kbps; > > > > > > dev $INTERFACE > > { > > egress > > { > > class (<$user1>) if ip_src == 192.168.0.2; > > class (<$user2>) if ip_src == 192.168.1.2; > > class (<$user3>) if ip_src == 127.0.0.1; > > > > htb () > > { > > class (rate $MAX, ceil $MAX) > > { > > $user1 = class (rate $RATE_USER1, ceil $MAX) {sfq;}; > > $user2 = class (rate $RATE_USER2, ceil $MAX) {sfq;}; > > $user3 = class (rate $RATE_USER3, ceil $MAX) {sfq;}; > > } > > } > > } > > } > > > > > > The resulting tc-skript: > > > > tc qdisc del dev ippp0 root > > > > # =============================== Device ippp0 > > ================================ > > > > tc qdisc add dev ippp0 handle 1:0 root dsmark indices 4 default_index 0 > > tc qdisc add dev ippp0 handle 2:0 parent 1:0 htb > > tc class add dev ippp0 parent 2:0 classid 2:1 htb rate 9375bps ceil 9375bps > > tc class add dev ippp0 parent 2:1 classid 2:2 htb rate 7500bps ceil 9375bps > > tc qdisc add dev ippp0 handle 3:0 parent 2:2 sfq > > tc class add dev ippp0 parent 2:1 classid 2:3 htb rate 1500bps ceil 9375bps > > tc qdisc add dev ippp0 handle 4:0 parent 2:3 sfq > > tc class add dev ippp0 parent 2:1 classid 2:4 htb rate 375bps ceil 9375bps > > tc qdisc add dev ippp0 handle 5:0 parent 2:4 sfq > > tc filter add dev ippp0 parent 2:0 protocol all prio 1 tcindex mask 0x3 > > shift 0 > > tc filter add dev ippp0 parent 2:0 protocol all prio 1 handle 3 > > tcindex classid 2:4 > > tc filter add dev ippp0 parent 2:0 protocol all prio 1 handle 2 > > tcindex classid 2:3 > > tc filter add dev ippp0 parent 2:0 protocol all prio 1 handle 1 > > tcindex classid 2:2 > > tc filter add dev ippp0 parent 1:0 protocol all prio 1 u32 match u32 > > 0xc0a80002 0xffffffff at 12 classid 1:1 > > tc filter add dev ippp0 parent 1:0 protocol all prio 1 u32 match u32 > > 0xc0a80102 0xffffffff at 12 classid 1:2 > > tc filter add dev ippp0 parent 1:0 protocol all prio 1 u32 match u32 > > 0x7f000001 0xffffffff at 12 classid 1:3 > > > >
First of all, I am new to tc and QOS as well, but I will try my best to give a hand. >From what little I understand, yours should work, but you might also give this a try since you already seem to have all the required apps installed. Earlier this week, I started using tc to do shaping on my network. I came across a great resource: www.lartc.org The article I am referencing is: http://www.lartc.org/howto/lartc.cookbook.fullnat.intro.html One of the main differences between this setup and yours is in the host's setup. Instead of declaring a host for the server, it defaults all traffic to the lowest class, and discriminately boosts the priority of certain hosts, protocols, destinations, etc using iptables. Here is a quick excerpt: He recommends using 75% of your max bandwidth to prevent excess lag. CEIL=75 tc qdisc add dev ippp0 root handle 1: htb default 12 tc class add dev ippp0 parent 1: classid 1:1 htb rate ${CEIL}kbit ceil ${CEIL}kbit tc class add dev ippp0 parent 1:1 classid 1:10 htb rate 60kbit ceil ${CEIL}kbit prio 0 tc class add dev ippp0 parent 1:1 classid 1:11 htb rate 12kbit ceil ${CEIL}kbit prio 1 tc class add dev ippp0 parent 1:1 classid 1:12 htb rate 3kbit ceil ${CEIL}kbit prio 2 tc filter add dev ippp0 parent 1:0 protocol ip prio 1 handle 1 fw classid 1:10 tc filter add dev ippp0 parent 1:0 protocol ip prio 2 handle 2 fw classid 1:11 tc filter add dev ippp0 parent 1:0 protocol ip prio 3 handle 3 fw classid 1:12 Now he suggests using iptables, or ip chains to mark the packets. I am unsure about ipchains if that is what you are using, sorry. iptables -t mangle -A PREROUTING -s 192.168.0.2 -j MARK --set-mark 0x1 iptables -t mangle -A PREROUTING -s 199.168.0.2 -j RETURN iptables -t mangle -A PREROUTING -s 192.168.1.2 -j MARK --set-mark 0x2 iptables -t mangle -A PREROUTING -s 199.168.1.2 -j RETURN I'm not sure this would work out of the box, or that is in reality any different than what you are already using. Anyway, Also try this command: tc -s class show dev ippp0 This will show a formatted display of what filters you are using, and how many packets are being used in each filter. Hopefully this will be of some help. Please post back with either success or failure, I would love to know the outcome. Happy hunting for a solution...