Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: "Manfred Bartz" <md-lartc@logi.cc>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] How to use tc to limit bandwidth of a special IP in LAN
Date: Tue, 12 Jun 2001 09:39:32 +0000	[thread overview]
Message-ID: <marc-lartc-99233895629789@msgid-missing> (raw)
In-Reply-To: <marc-lartc-99233276410622@msgid-missing>

Chuanbo Xu <iproute2@btamail.net.cn> writes:

> I want to limit bandwidth of a special IP in LAN, when it upload or
> download from Internet through Linux server. How to use tc to do?

The HOWTO covers this quite well:
        <http://www.linuxdoc.org/HOWTO/Adv-Routing-HOWTO.html>
but there were two hiccups I encountered:
1. with "tc class" the priority must be no more than 8
2. with "tc filter" the priority must be no more than 99

Here is my setup (shortened), modify to suit:

## ROOT Class
tc qdisc add dev eth2 root handle 12: cbq bandwidth 10Mbit avpkt 1400

tc class add dev eth2 parent 12: classid 12:1 cbq bandwidth 10Mbit \
   rate 10Mbit allot 1514 weight 1Mbit prio 2 maxburst 20 avpkt 1400

## FLOWs
# 192.168.2.12 (unbounded)
tc class add dev eth2 parent 12:1 classid 12:212 cbq bandwidth 10Mbit \
   rate 256Kbit allot 1514 weight 25Kbit prio 5 maxburst 20 avpkt 1400

# 192.168.2.13 (bounded)
tc class add dev eth2 parent 12:1 classid 12:213 cbq bandwidth 10Mbit \
   rate 64Kbit allot 1514 weight 6Kbit prio 5 maxburst 20 avpkt 1400 bounded

# unbounded class for local traffic
tc class add dev eth2 parent 12:1 classid 12:300 cbq bandwidth 10Mbit \
   rate 3Mbit allot 1514 weight 300Kbit prio 3 maxburst 20 avpkt 1400

## QDISCs
tc qdisc add dev eth2 parent 12:212 sfq quantum 1514b perturb 15
tc qdisc add dev eth2 parent 12:213 sfq quantum 1514b perturb 15
tc qdisc add dev eth2 parent 12:300 sfq quantum 1514b perturb 15

## FILTERs
# unbounded class (local)
tc filter add dev eth2 parent 12:0 protocol ip prio 10 u32 \
   match ip src 192.168.2.0/24  flowid 12:300

# bounded classes (Internet)
tc filter add dev eth2 parent 12:0 protocol ip prio 20 u32 \
   match ip dst 192.168.2.12 flowid 12:212
tc filter add dev eth2 parent 12:0 protocol ip prio 20 u32 \
   match ip dst 192.168.2.13 flowid 12:213


I have only limited downloads.  To cover uploads as well you need to 
do the same thing for that direction.

-- 
Manfred
----------------------------------------------------------------
NetfilterLogAnalyzer, NetCalc, whois at: <http://logi.cc/linux/>


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

  reply	other threads:[~2001-06-12  9:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-12  7:59 [LARTC] How to use tc to limit bandwidth of a special IP in LAN Chuanbo Xu
2001-06-12  9:39 ` Manfred Bartz [this message]
2001-06-14  3:13 ` Bob Puff@NLE
2001-06-15  5:57 ` Stef Coene
2001-06-15  5:57 ` Stef Coene
2001-06-15 14:27 ` Ramin Alidousti
2001-06-18  5:40 ` Stef Coene
2001-06-18  5:40 ` Stef Coene

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-99233895629789@msgid-missing \
    --to=md-lartc@logi.cc \
    --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