[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Problems with traffic shaping (tcng / tc)



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



Reply to: