Skip to contentSkip to conversation

Tcng and wondershaper

LARTC Wouter Coppens 3 participants 3 messages Apr 20, 2003 – Apr 25, 2003

lore
Share & tools
lore
#0 lore raw

Hey,

Has anybody converted the wondershaper to tcng? I'm very interessed in it and would like to see how it's done.

Thanks,

Wouter

#1 lore raw

Wouter,

: Has anybody converted the wondershaper to tcng? I'm very interessed in : it and would like to see how it's done.

I would love to do this--I simply haven't made the time to do so yet. I would imagine somebody will beat me to it, but if not, I'll have my variant available at some point in the future, and I'll remember to post a note here to let people know it's available.

Have you thought of trying to make it yourself?

If you want a few basic examples of tcng, there are a dozen or so simple examples in the ./examples-ng directory from the tcng distribution, and there are many syntactic elements in the ./tests directory. You can look at my commented examples in my tcng/htb HOWTO [1], and the tcng manual [2].

Since the wondershaper is so well-documented (rationale and approach), you should be able to create something similar with tcng.

Ciao for now,

-Martin

[1] http://tldp.org/HOWTO/Traffic-Control-tcng-HTB-HOWTO/
[2] http://linux-ip.net/gl/tcng/

Signature · 5 lines
Martin A. Brown --- SecurePipe, Inc. --- [email protected]

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#2 lore raw
In reply to Wouter Coppens
Quoted 10 lines

Wouter,

: Has anybody converted the wondershaper to tcng? I'm very interessed in : it and would like to see how it's done.

I would love to do this--I simply haven't made the time to do so yet. I would imagine somebody will beat me to it, but if not, I'll have my variant available at some point in the future, and I'll remember to post a note here to let people know it's available.

Here is a first untested draft of wshaper_tcng.htb:
- Jacob

#!/bin/bash
# Wonder Shaper

# please read the README before filling out these values
#
# Set the following values to somewhat less than your actual download
# and uplink speed. 

#Set the device that is to be shaped.

DEV=ppp0

# Set uplink, downlink and worse fate claasifier. Search for downlink, uplink and worse_fate.

#Now remove the following two lines :-)
echo Please read the documentation in 'README' first exit

if [ "$1" = "status" ]
then
tc -s qdisc ls dev $DEV
tc -s class ls dev $DEV
exit
fi

# clean existing down- and uplink qdiscs, hide errors
tc qdisc del dev $DEV root    2> /dev/null > /dev/null
tc qdisc del dev $DEV ingress 2> /dev/null > /dev/null

if [ "$1" = "stop" ]
then
exit
fi

tcc -Xp,-DDEVICE=$DEV <<EOF | /bin/bash -v

// Set the following values to somewhat less than your actual download and uplink speed.

\$downlink = 800 kbps;
\$uplink = 220 kbps;

// some traffic however suffers a worse fate
\$worse_fate = 1;
/*
\$worse_fate (ip_src != 1.1.1.1 && ip_src:24 = 1.1.1.0 && ip_dst:24 = 2.2.2.0 &&
tcp_sport = PORT_SSH) ||
ip_tos != 0x10 || tcp_dport >= 2000;

!!!!!!! Do NOT use ip_src = 1.1.1.0/24 or ip_src:24 = 1.1.1.1 !!!!!!!

*/

#define xstr(s) str(s)
#define str(s) #s

dev xstr(DEVICE) {
     ingress {
	\$all_pol = SLB(cir \$downlink, cbs 10 kB);
	class (<>)  if SLB_ok(\$all_pol);
        drop if 1;
     }
     egress {
          class (<\$interactive>) if 

// ICMP (ip protocol 1) in the interactive so we
// can do measurements & impress our friends:

	ip_proto = IPPROTO_ICMP || 
// TOS Minimum Delay (ssh, NOT scp) :
	ip_tos = 0x10 || 
// To speed up downloads while an upload is going on, put ACK packets in
//  the interactive class:
			(tcp_ACK && ip_len < 64);
// some traffic however suffers a worse fate
          class (<\$worse_fate_class>) if \$worse_fate;

// bulk & default class

          class (<\$bulk>) if 1;

          htb () {
               class (rate \$uplink, burst 6kB) {
                    \$interactive = class (prio 1 ,rate \$uplink)   {sfq (perturb 10 sec);};
                    \$bulk  = class (prio 2, rate 0.9 *\$uplink) {sfq(perturb 10 sec);};
                    \$worse_fate_class  = class (prio 3, rate 0.8 *\$uplink) {sfq(perturb 10 sec);};
               }
          }
     }
}

EOF
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/