Equalizing bandwidth according to use

Linux Advanced Routing and Traffic Control

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

 



I need a way to prioritize packets without setting bandwidth limits.
For example, I have a client using the whole bandwidth. As soon as other clients need bandwidth, reduce the bandwidth of the former to not impair navigation, but as soon as finish the download, restore the initial client to his full bandwidth.

I'm trying to control torrent bandwidth usage to not impact the navigation, but at the same time using all the bandwidth when there is no navigation. The torrent traffic had TOS 0x48.

I tried a script using HFSC, but did not work as expected.

    #!/bin/bash

    TC=/usr/sbin/tc

    DEV=ppp0

    ID=1

    # Cleanup
    $TC qdisc del dev $DEV root 2>/dev/null

    # Classes

    ## Dev class
    $TC qdisc add dev $DEV root handle $ID: hfsc

    ## Root class
    $TC class add dev $DEV parent $ID: classid $ID:1 hfsc \
        sc rate 600kbit \
        ul rate 600kbit

    ## HTTP and prioritized packets
    $TC class add dev $DEV parent $ID:1 classid $ID:10 hfsc \
        sc rate 400kbit \
        ul rate 600kbit

    ## Trash traffic
    $TC class add dev $DEV parent $ID:1 classid $ID:20 hfsc \
        ul rate 400kbit \
        ls rate 200kbit


    # Filters

    ## Torrent
    $TC filter add dev $DEV parent $ID:0 protocol ip prio 1 u32 \
        match ip tos 0x48 0xff \
        flowid 1:20

    ## Resto
    $TC filter add dev $DEV parent $ID:0 prio 5 u32 \
        match ip src any flowid 1:10

--
To unsubscribe from this list: send the line "unsubscribe lartc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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