Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
* [LARTC] help using tc
@ 2001-11-09 19:00 David Ulevitch
  0 siblings, 0 replies; only message in thread
From: David Ulevitch @ 2001-11-09 19:00 UTC (permalink / raw)
  To: lartc

Hello lartc,

  I am trying to control bandwidth on a server which is connected to a
  full (expensive) 10mbit port.  I want to limit the bandwidth to
  128kbps.

  I wrote this small script from the documentation I could find but it
  fails in a few places.  Any pointers would be appreciated.  The end
  goal is to have one interface (eth0) which doesn't send or accept
  packets faster then at 128kbps.

  I think some of the problem is that I use the "root" class twice.
  If there is an easier way to do this, please let me know also.
  
#!/bin/bash

echo "Setting up packet limiting";
echo "  Deleting current class";
tc qdisc del dev eth0 root;

echo "";
echo "  Setting up downstream";
tc qdisc add dev eth0 root handle 10: cbq bandwidth 10mbit avpkt 1000;
tc class add dev eth0 parent 10:0 classid 10:1 cbq bandwidth 10Mbit \
rate 128Kbit allot 1514 weight 128Kbit prio 8 maxburst 20 avpkt 1000 \
bounded;
tc qdisc add dev eth0 parent 10:100 sfq quantum 1514b perturb 15;
tc filter add dev eth0 parent 10:0 protocol ip prio 25 u32 match ip \
dst 216.218.192.162 flowid 10:100;

echo "";
echo "  Setting up upstream";
tc qdisc add dev eth0 root handle 10: cbq bandwidth 10mbit avpkt 1000;
tc class add dev eth0 parent 10:0 classid 10:1 cbq bandwidth 10Mbit \
rate 128Kbit allot 1514 weight 128Kbit prio 8 maxburst 20 avpkt 1000 \
bounded;
tc qdisc add dev eth0 parent 10:100 sfq quantum 1514b perturb 15;
tc filter add dev eth0 parent 10:0 protocol ip prio 25 u32 match ip \
src 216.218.192.162 flowid 10:100;

echo "";
echo "done";


 
Thanks,
 David Ulevitch                       mailto:davidu@everydns.net
 Founder, EveryDNS.net                http://www.everydns.net     



_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-11-09 19:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-09 19:00 [LARTC] help using tc David Ulevitch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox