#!/bin/bash -x
DOWNLINK=80000
UPLINK=80000
DEV0="eth0"
DEV1="eth1"
if [ "$1" = "status" ]
then
tc -s qdisc ls dev $DEV0
tc -s class ls dev $DEV0
tc -s qdisc ls dev $DEV1
tc -s class ls dev $DEV1
exit
fi
#Remove all previous queues
echo "deleting..."
tc qdisc
tc qdisc
tc class
tc class
if [ "$1" = "stop" ]
then
exit
fi
#add the root
echo "adding..."
tc qdisc add dev $DEV0 root handle 1: htb default 30
tc qdisc add dev $DEV1 root handle 2: htb default 30
tc class add dev $DEV0 parent 1: classid 1:1 htb rate 100Mbit burst 256k
tc class add dev $DEV1 parent 2: classid 2:2 htb rate 100Mbit burst 256k
#set up two classes attached to the root (download from server)
tc class add dev $DEV0 parent 1:1 classid
tc class add dev $DEV0 parent 1:1 classid
#set up two classes attached to the root (upload from client)
tc class add dev $DEV1 parent 2:2 classid
tc class add dev $DEV1 parent 2:2 classid
#make each of them use stochasitic fairness queueing (download from server)
tc qdisc add dev $DEV0 parent
tc qdisc add dev $DEV0 parent
#make each of them use stochasitic fairness queueing (upload from client)
tc qdisc add dev $DEV1 parent
tc qdisc add dev $DEV1 parent
#add the layer7 filter to two of them (download from server)
tc filter add dev $DEV0 protocol ip parent 1:0 prio 1 layer7 protocol ftp classid 1:10
tc filter add dev $DEV0 protocol ip parent 1:0 prio 1 layer7 protocol http classid 1:20
#add the layer7 filter to two of them (download from server)
tc filter add dev $DEV1 protocol ip parent 2:0 prio 2 layer7 protocol ftp classid 2:10
tc filter add dev $DEV1 protocol ip parent 2:0 prio 1 layer7 protocol http classid 2:20
if [ "$1" = "stop" ]
then
exit
fi
#show the result
echo "the ftp use 30% bandwidth http use 70% "
PC1 PC2 PC3
eth0 &
nbsp; eth0 eth1 eth0
192.168.1.0 192.168.1.245 192.168.2.245 192.168.2.0
FTP Server Sub-network A Sub-network B 
; Client
Web-Server Qos Tool   ;Download tool
FTP-Server = Bullet Proof FTP Server v2.21
Web-Server = TOMCAT Apache
Download tool = Net Transfer
Qos tool = Qos Layer 7 Packet filter
The testing system environment
MSN 8 helps ELIMINATE E-MAIL VIRUSES. Get 2 months FREE*. _______________________________________________ LARTC mailing list / LARTC@xxxxxxxxxxxxxxx http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/