Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: David Ulevitch <davidu@everydns.net>
To: lartc@vger.kernel.org
Subject: [LARTC] help using tc
Date: Fri, 09 Nov 2001 19:00:57 +0000	[thread overview]
Message-ID: <marc-lartc-100533250627571@msgid-missing> (raw)

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/

                 reply	other threads:[~2001-11-09 19:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-lartc-100533250627571@msgid-missing \
    --to=davidu@everydns.net \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox