Re: IP based bandwith limit

Linux Advanced Routing and Traffic Control

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

 




Hi 

like I said, I am new too, so take this with a grain of salt. 

> unfortunately there is only one interface for the customers. My problem 
> is to limit the up AND down speed in dependence to each other.

Downloads become uploads on your internal interface!

so if eth0 is your external interface a download would be INCOMING on eth0 
but as it is going on to your internal interface (e.g. eth1) it becomes an 
upload to your customer. So incoming traffic from the internet to your 
customers is outgoing on eth1. 

if you do this on eth1: 
--------------
#!/bin/bash
tc qdisc add dev eth1 root handle 1: htb default 20
tc class add dev eth1 parent 1: classid 1:1 htb rate 90mbit burst 15k
tc class add dev eth1 parent 1:1 classid 1:10 htb rate 10mbit 
                                                      prio 0 burst 15k
tc class add dev eth1 parent 1:1 classid 1:20 htb rate 1mbit ceil 1mbit
						      burst 6k prio 1
U32="tc filter add dev eth1 protocol ip parent 1:0 prio 0 u32"
$U32 match ip dst 192.168.1.19 flowid 1:10
---------------

Then you have split the traffic into two classes: 

one for the preferred customer, who gets 10Mbit and a default for all the 
other traffic, which gets 1Mbit. It still leaves a lot of bandwidth 
unused! (79 Mbit)

I have made the experience (which cost me an awful lot of time) that 
assuming the interface woudl produce excactly 100Mbit is a mistake and htb 
does unexpected things. It is probably bets to lower the parent class 
trafic 1: to something about 10% below your actual internet connection, 
even on your internal interface. (Please correct me if I am completely 
wrong!) I used iptraf to have a look on the throughput. 


You would have to do something similar for actual uploads from your 
customers to the internet on eth0, but as you probably nat the traffic I 
am not certain what you would do there! Anyone else?

greetings, 

.peter

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

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