如何只删除 htb 中的一个队列?

如何只删除 htb 中的一个队列?

当 htb 中有两个队列时,我想只删除一个队列。我的脚本如下:

TC=/sbin/tc
IF=wlan0             # Interface 
DNLD=1mbit          # DOWNLOAD Limit
UPLD=1mbit          # UPLOAD Limit 
IP1="myIPset1"     # Host IP
IP2="myIPset2"
U32="$TC filter add dev $IF protocol ip parent 1:0 prio 1 u32"

start() {

    $TC qdisc add dev $IF root handle 1: htb default 30
    $TC class add dev $IF parent 1: classid 1:1 htb rate $DNLD
    $TC class add dev $IF parent 1: classid 1:2 htb rate $UPLD
    $TC filter add dev $IF parent 1: prio 1 protocol ip u32 match ip src $IP1 flowid 1:1
    $TC filter add dev $IF parent 1: prio 1 protocol ip u32 match ip src $IP2 flowid 1:2

    # Add impairments with netem
    $TC qdisc add dev $IF parent 1:1 handle 1: netem delay 100ms


}

stop() {

    $TC qdisc del dev $IF root

}

restart() {

    stop
    sleep 1
    start
    }

show() {

    $TC -s qdisc ls dev $IF
    }
case "$1" in

  start)
        echo -n "Starting bandwidth shaping: "
    start
    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:\n"
    show
    echo ""
    ;;

  *)
        pwd=$(pwd)
    echo "Usage: $(/usr/bin/dirname $pwd)/tc.bash {start|stop|restart|show}"
    ;;

esac
exit 0

尽管如此,我找不到一种方法来仅删除一个队列,而是从根删除每个队列。如何只删除 1:1 队列?

相关内容