HTB - shaping services and IP

Linux Advanced Routing and Traffic Control

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

 



Hello all,
    I am trying to solve this problem for more than a month and can not still find a way how to do it.
If you could please help me and many other people interested in the same problem.

Lets say, I got this configuration
_____________________________________________      160kbps/96kbps    _____
|imq0(eth1, eth2) Linux router with NAT>ppp0|------------------------|ISP|
---------------------------------------------                        -----
    +|Roman| - 192.168.1.10 on eth1
    +|Phill| - 192.168.2.10 on eth2
        + ...

The point is, that I want to shape the speed of each client
and I want to shape the speed of the services the client uses.
I don't use iptables to mark the packets, because the use of IMQ,
but I know that there is a patch for this.

So for ex. I want to do if the user is downloading something from FTP,
that he would be able to use the other services like websurfing
or playing games at the same speed as if he didn't download.

Roman -  Rate 80 Ceil 160
   +FTP Rate 1 Ceil 160
   +Other Traffic Rate 79 Ceil 160

Then I got Phill  with the same settings,
but that if Roman is downloading something from FTP it will slow down
while Phill is surfing the web.
There will be some clients, whoose services I dont want to shape,
that's why I want to do it this way.

Please help me any way, I tried almost everything to get this working
 
Thank you very much,
    Phill
 
---This is my latest idea---
 
LOCAL="imq0"
NET="ppp0"
 
IPT=/sbin/iptables
 
modprobe imq numdevs=1
ip link set imq0 up
$IPT -t mangle -A PREROUTING -i ppp0 -j IMQ
 
tc qdisc add dev $LOCAL root handle 1: htb default 999
 
tc class add dev $LOCAL parent 1:0  classid 1:1  htb rate 160kbit ceil 160kbit
 
#Roman
    tc class add dev $LOCAL parent 1:1 classid 1:110 htb rate 80kbit ceil 160kbit
        tc class add dev $LOCAL parent 1:110 classid 1:1101 htb rate rate 79kbit ceil 160kbit
        tc class add dev $LOCAL parent 1:110 classid 1:1102 htb rate 1kbit ceil 160kbit
    tc filter add dev $LOCAL parent 1:0 protocol ip u32 match ip dst 192.168.1.10 flowid 1:110
        tc filter add dev $LOCAL parent 1:110 protocol ip u32 match ip dst 192.168.1.10 flowid 1:1101
        tc filter add dev $LOCAL parent 1:110 protocol ip u32 match ip dport 20 0xffff flowid 1:1102 
        tc filter add dev $LOCAL parent 1:110 protocol ip u32 match ip dport 21 0xffff flowid 1:1102 
#Phill
    tc class add dev $LOCAL parent 1:1 classid 1:210 htb rate 80kbit ceil 160kbit
        tc class add dev $LOCAL parent 1:210 classid 1:2101 htb rate rate 79kbit ceil 160kbit
        tc class add dev $LOCAL parent 1:210 classid 1:2102 htb rate 1kbit ceil 160kbit
    tc filter add dev $LOCAL parent 1:0 protocol ip u32 match ip dst 192.168.1.10 flowid 1:210
        tc filter add dev $LOCAL parent 1:210 protocol ip u32 match ip dst 192.168.1.10 flowid 1:2101
        tc filter add dev $LOCAL parent 1:210 protocol ip u32 match ip dport 20 0xffff flowid 1:2102 
        tc filter add dev $LOCAL parent 1:210 protocol ip u32 match ip dport 21 0xffff flowid 1:2102 

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux