[LARTC] Help with shaping incoming bandwith + NAT

Linux Advanced Routing and Traffic Control

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

 



Hello there. I would like some help with getting bandwith shaping to
work, I'm sure that my questions are not that bright but I haven't been
able to find any clues anywhere else. I have a Linux box ('server')
acting as a NAT/firewall which is connected to the net (via eth1) with a
128 Kbps cable modem. I also have another 4 networked computers which
are connected to the server via eth0. I would like to shape the
*incoming* network bandwidth so that all of the computers have a minimum
incoming throughput and are able to borrow unused bandwidth (so HTB
seemed like a first pick choice). The problem here is that I can't seem
to get it 100 % straight. My most successful attempt has been setting up
a htb queue as root in eth1, something like this:=20

8<----------------8<----------------8<----------------8<----------------

ADD=3D"tc class add dev eth0"=20
MAXRATE=3D128kbit=20
SHARERATE=3D28kbit=20
BURST=3D2k=20
ROOT_HANDLE=3D1=20

## root qdisc=20
tc qdisc add dev eth0 root handle $ROOT_HANDLE: htb default 99=20

## main node=20
$ADD parent $ROOT_HANDLE: classid $ROOT_HANDLE:1 htb rate $MAXRATE ceil
$MAXRATE burst $BURST=20

## children=20

POLICY=3D"htb rate $SHARERATE ceil $MAXRATE burst $BURST"=20

$ADD parent $ROOT_HANDLE:1 classid $ROOT_HANDLE:17 $POLICY=20
$ADD parent $ROOT_HANDLE:1 classid $ROOT_HANDLE:11 $POLICY=20
$ADD parent $ROOT_HANDLE:1 classid $ROOT_HANDLE:12 $POLICY=20
$ADD parent $ROOT_HANDLE:1 classid $ROOT_HANDLE:13 $POLICY=20

## default node=20
$ADD parent $ROOT_HANDLE:1 classid $ROOT_HANDLE:99 htb rate 1kbps ceil
$MAXRATE burst $BURST=20

## secondary node=20
$ADD parent $ROOT_HANDLE: classid $ROOT_HANDLE:2 htb rate 11mbit=20

8<----------------8<----------------8<----------------8<----------------

and the adequate filters (the traffic which goes to the internal network
PCs is sent to :11, :12, :13 or :17, according to the destination IP,
and the traffic from the server to the internal network is sent to :2 so
that it is not limited). The filters seem to be working fine.=20

The problem here is that, theoretically, each computer in the network
should be able to claim 28 kbps (=3D about 3.5 kbyte/s) for itself no
matter how busy the link is. However, this just won't happen. The script
*seems* to have a positive effect, so that I can surf the net somewhat
faster while my pal is massively downloading files, but the minimum
bandwidth is not enforced (not even remotely!). For instance, now I know
that another computer in the network is downloading from a very fast
site (my ISP internal news server). I begin downloading from kernel.org
the latest source, divide the download in 10 simultaneous pieces, and
withing 10 seconds the bandwidth is all mine (the d/l speed in the other
computer is about .5 kbyte/s). Theoretically, it should get at least its
assigned 3.5 kbyte/s, and, furthermore, the load should be balanced  so
that we have a rate of about 7.5 kbyte/s (the total bandwidth is 16
kbyte/s) for each of the computers.=20

I would like to know what am I doing wrong. Would switching to CBQ or
any other queuing discipline be an option? I have experimented with the
ingress qdisc, but as it doesn't seem possible to attach queues to that
qdisc it doesn't work the way I want it to. I'm running 2.4.18 with the
HTB patch applied and the tc binary found in the HTB homepage.=20

Thanx in advance :)=20

PS: If you can, please CC your reply to alnatural@dreamers.com. I'm
subscribed to the 'digest' list so if you don't I won't be able to read
your reply 'til tomorrow ;)=20

--=20
Jos=E9 Manuel L=F3pez-Cepero - SiGMA - alnatural@dreamers.com
RedHatLinux7.1
---
"=BFSabes una cosa que me hace mucha ilusi=F3n que me hayas regalado,
  pero que a la vez me da mucho miedo? Tu inocencia."
--=20
Jos=E9 Manuel L=F3pez-Cepero - SiGMA - alnatural@dreamers.com
RedHatLinux7.1
---
"=BFSabes una cosa que me hace mucha ilusi=F3n que me hayas regalado,
  pero que a la vez me da mucho miedo? Tu inocencia."



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