[LARTC] throttling outgoing bandwidth with IP aliasing

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux