traffic control probleme.

Einrichten des lokalen Netzes, Verbindung zu anderen Computern und Diensten.
Antworten
eimer
Beiträge: 77
Registriert: 09.11.2005 12:55:49
Wohnort: Endingen a.K.

traffic control probleme.

Beitrag von eimer » 18.01.2009 17:08:11

Hi Leute,
wenn ich das script ausführe kommt bei mir dieser Fehler.

Code: Alles auswählen

Enter Upload Speed in kbps: 0
Upload is now set to: 0
Restarting bandwidth shaping: "rate" is required.
RTNETLINK answers: Invalid argument
done
kann mir einer sagen was falsch ist, ich bekomm es nicht gebacken.

mfg eimer

Code: Alles auswählen

#!/bin/bash
#
# Created by Discovery for PSA
#
# Name of the traffic control command.
TC=/sbin/tc

# The network interface we're planning on limiting bandwidth.
IF=eth0             # Interface

# Download limit (in mega bits)
DNLD=1000Mbit         # DOWNLOAD Limit

# IP address of the machine we are limiting the uploads on.
# IP=192.168.178.xx     # Host IP

# Filter options for limiting the intended interface.
# U32="$TC filter add dev $IF protocol ip parent 1:0 prio 1 u32"

start() {

# We'll use Hierarchical Token Bucket (HTB) to shape bandwidth.
# For detailed configuration options, please consult Linux man
# page.

$TC qdisc add dev $IF root handle 1: htb default 10
$TC class add dev $IF parent 1: classid 1:1 htb rate $DNLD burst 15k
$TC class add dev $IF parent 1:1 classid 1:10 htb rate $DNLD ceil $DNLD burst 15k
$TC class add dev $IF parent 1:1 classid 1:20 htb rate $UPLD

$TC qdisc add dev $IF parent 1:10 handle 10: sfq perturb 10
$TC qdisc add dev $IF parent 1:20 handle 20: sfq perturb 10

$TC filter add dev $IF protocol ip parent 1:0 prio 1 handle 10 fw flowid 1:10
$TC filter add dev $IF protocol ip parent 1:0 prio 1 handle 20 fw flowid 1:20


iptables -t mangle -A OUTPUT -p tcp --sport xxxxxx:xxxxx -j MARK --set-mark 0x14


# The first line creates the root qdisc, and the next two lines
# create three child qdisc that are to be used to shape download
# and upload bandwidth.

}

stop() {

# Stop the bandwidth shaping.
    $TC qdisc del dev $IF root
iptables -t mangle -F
}

upload() {

    read -p 'Enter Upload Speed in kbps: ' UPLD
}

restart() {

# Self-explanatory.
    stop
    sleep 1
    start

}

show() {

# Display status of traffic control status.
    $TC -s qdisc ls dev $IF

}

case "$1" in

  start)

    upload
    echo -n "Starting bandwidth shaping: "
    start
    echo "done"
    ;;

  upload)
    read -p 'Enter Upload Speed in kbps: ' UPLD
    echo "Upload is now set to: $UPLD"
    echo -n "Restarting bandwidth shaping: "
    restart
    echo "done"
    ;;

  stop)

    echo -n "Stopping bandwidth shaping: "
    stop
    echo "done"
    ;;

  restart)

    echo -n "Restarting bandwidth shaping: "
    restart
    echo "done"
    ;;

  show)

    echo "Bandwidth shaping status for $IF:"
    show
    echo ""
    ;;

  *)

    pwd=$(pwd)
    echo "Usage: tc.bash {start|upload|stop|restart|show}"
    ;;

esac

exit 0
Gi´me hope Juana.....

Antworten