Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: Shirley Wang <SWang@appliant.com>
To: lartc@vger.kernel.org
Subject: [LARTC] throttling outgoing bandwidth with IP aliasing
Date: Thu, 17 Jan 2002 03:02:11 +0000	[thread overview]
Message-ID: <marc-lartc-101123660720130@msgid-missing> (raw)

Hello all,

I have an end host with just 1 physical network card whose address is
a.b.c.d, and I need to throttle the outgoing bandwidth from a set of aliased
IP address to a remote server e.f.g.h.  I'm running RedHat 7.1 with 2.4.2
kernel.

I have attached 192.168.10.1 to eth0:1 and 192.168.10.2 to eth0:2
I have set up NATting for these aliases addresses by:
	iptables -A POSTROUTING -t nat -s 192.168.10.1 -j SNAT --to a.b.c.d
	iptables -A POSTROUTING -t nat -s 192.168.10.2 -j SNAT --to a.b.c.d

I have also set up bandwidth limitation using tc:
	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 10Mbit allot 1514 weight 1Mbit prio 8 maxburst 20 avpkt
1000

	tc class add dev eth0 parent 10:1 classid 10:100 cbq bandwidth
10Mbit \
		rate 56kbit allot 1514 weight 5Kbit prio 5 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 100 u32 match ip
\
		dst e.f.g.h flowid 10:100

I have written a little program that could connect to e.f.g.h using the
aliases IPs, transfer a file, and measure the throughput (similar to ftp
except using private IP).  However, I was seeing throughput far greater than
the expected 56Kbps (around 1Mbps).  It doesn't seem like any packets are
being sent to handle 10:100, looking from the output for '/sbin/tc -s -d
class ls dev eth0':

-----------begin output-----------
class cbq 10: root rate 10Mbit cell 8b (bounded,isolated) prio no-transmit/8
weight 10Mbit allot 1514b 
level 2 ewma 5 avpkt 1000b maxidle 23us 
 Sent 4469982 bytes 4672 pkts (dropped 0, overlimits 0) 
  borrowed 0 overactions 0 avgidle 624 undertime 0
class cbq 10:100 parent 10:1 leaf 8021: rate 56Kbit cell 8b (bounded) prio
5/5 weight 5Mbit allot 1514b 
level 0 ewma 5 avpkt 1000b maxidle 123062us 
 Sent 0 bytes 0 pkts (dropped 0, overlimits 0) 
  borrowed 0 overactions 0 avgidle 3.22605e+06 undertime 0
class cbq 10:1 parent 10: rate 10Mbit cell 8b prio no-transmit/8 weight
1Mbit allot 1514b 
level 1 ewma 5 avpkt 1000b maxidle 23us 
 Sent 0 bytes 0 pkts (dropped 0, overlimits 0) 
  borrowed 0 overactions 0 avgidle 624 undertime 0
-----------end output-----------

Is what I'm trying to achieve possible?  What am I missing?  Is it because I
added the rules to eth0 but the aliased IPs are on eth0:1 and eth0:2?  

Any help would be greatly appreciated!

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

                 reply	other threads:[~2002-01-17  3:02 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-101123660720130@msgid-missing \
    --to=swang@appliant.com \
    --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