#!/bin/bash
# change these values to suit your needs
ETHERNET_DEVICE="eth0"
LINK_SPEED="1000Mbit"
UPLOAD_SPEED="50Mbit"
PORT="80"
tc qdisc del dev $ETHERNET_DEVICE root
tc qdisc add dev $ETHERNET_DEVICE root handle 1: htb default 11
tc class add dev $ETHERNET_DEVICE parent 1: classid 1:1 htb rate $LINK_SPEED
tc class add dev $ETHERNET_DEVICE parent 1:1 classid 1:10 htb rate $UPLOAD_SPEED
tc class add dev $ETHERNET_DEVICE parent 1:1 classid 1:11 htb rate $LINK_SPEED
tc filter add dev $ETHERNET_DEVICE protocol ip parent 1:0 prio 1 u32 match ip sport $PORT 0xffff flowid 1:10
- Feb 02 Mon 2009 09:55
Linux 用 tc 控制頻寬
# delete previous root node
# create root node
# create LINK class
# create our HTTP shaping class
# create our REST class for unutilized bandwidth
# create the filter for the HTTP class, we filter on source port 80 (http)
全站熱搜
留言列表
發表留言