Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 has 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
share|improve this question
    
Sounds like you need some form of policy based routing - try policyrouting.org/PolicyRoutingBook/ONLINE/TOC.html –  Chopper3 Jun 22 '12 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.