|
lug-bg: HTB problem
- Subject: lug-bg: HTB problem
- From: "Qsin" <qsin@xxxxxxxxxxxx>
- Date: Mon, 3 Nov 2003 16:34:31 +0200
Нужно ми беше решение за HTB подобно на описания от Никола Колев в
http://www.mail-archive.com/lug-bg@xxxxxxxxxxxxxxxxxx/msg15376.html
Като начало реших да опитам скрипта без никакво изменение:
#!/bin/bash
# изходящ интерфейс
dev=eth0
# път до tc
tc=/sbin/tc
htb_stats ()
{
# show class stats
$tc -s -d class show dev $dev
# show qdisc stats
$tc -s -d qdisc show dev $dev
} #htb_stats
htb_stop ()
{
# remove all qdiscs from $dev
$tc qdisc del dev $dev root &>/dev/null
} # htb_stop
htb_start ()
{
set -x
# attach root discipline
$tc qdisc add dev $dev root handle 1: htb default 1000 r2q 10
# клас за клиент с гарантирани 256Кбита
$tc class add dev $dev parent 1: classid 1:10 htb rate 256Kbit
$tc filter add dev $dev protocol ip parent 1:0 prio 4 u32 \
match ip dst 192.168.0.119 flowid 1:10
$tc qdisc add dev $dev parent 1:10 handle 10: sfq perturb 20
# клас за клиент с гарантирани 128Кбита
$tc class add dev $dev parent 1: classid 1:20 htb rate 128Kbit
$tc filter add dev $dev protocol ip parent 1:0 prio 4 u32 \
match ip dst 192.168.0.210 flowid 1:20
$tc qdisc add dev $dev parent 1:20 handle 20: sfq perturb 20
# клас за клиент с гарантирани 64Кбита
$tc class add dev $dev parent 1: classid 1:30 htb rate 64Kbit
$tc filter add dev $dev protocol ip parent 1:0 prio 4 u32 \
match ip dst 192.168.0.11 flowid 1:30
$tc qdisc add dev $dev parent 1:30 handle 30: sfq perturb 20
# default клас, в който попадат всички останали
# за него заделяме 64Кбита
$tc class add dev $dev parent 1:0 classid 1:1000 htb \
rate 64Kbit ceil 64Kbit
$tc qdisc add dev $dev parent 1:1000 handle 1000: sfq perturb 20
} # htb_start
case "$1" in
### START ###
start)
htb_start
;;
### STOP ###
stop)
htb_stop
;;
### RESTART ###
restart)
$0 stop
$0 start
;;
### STATS ###
stats)
htb_stats
;;
### default ###
*)
echo "Usage: " `basename $0` "{start|stop|restart|stats}"
esac
При което получих следното със рязко забавяне на машината:
/htb.3 start
+ /sbin/tc qdisc add dev eth0 root handle 1: htb default 1000 r2q 10
+ /sbin/tc class add dev eth0 parent 1: classid 1:10 htb rate 256Kbit
+ /sbin/tc filter add dev eth0 protocol ip parent 1:0 prio 4 u32 match ip
dst 192.168.0.119 flowid 1:10
RTNETLINK answers: Invalid argument
+ /sbin/tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 20
+ /sbin/tc class add dev eth0 parent 1: classid 1:20 htb rate 128Kbit
+ /sbin/tc filter add dev eth0 protocol ip parent 1:0 prio 4 u32 match ip
dst 192.168.0.210 flowid 1:20
RTNETLINK answers: Invalid argument
+ /sbin/tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 20
+ /sbin/tc class add dev eth0 parent 1: classid 1:30 htb rate 64Kbit
+ /sbin/tc filter add dev eth0 protocol ip parent 1:0 prio 4 u32 match ip
dst 192.168.0.11 flowid 1:30
RTNETLINK answers: Invalid argument
+ /sbin/tc qdisc add dev eth0 parent 1:30 handle 30: sfq perturb 20
+ /sbin/tc class add dev eth0 parent 1:0 classid 1:1000 htb rate 64Kbit ceil
64Kbit
+ /sbin/tc qdisc add dev eth0 parent 1:1000 handle 1000: sfq perturb 20
А и трафика през мойта машина (192.168.0.210) нямаще нищо общо с 128 Kbit
Явор Атанасов
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
|
|
|