Koozali.org: home of the SME Server

Limiting bandwith for 1 lan ip

lajgaard

Limiting bandwith for 1 lan ip
« Reply #15 on: December 14, 2004, 10:32:58 AM »
Thank you for your reply. It helped me alot. I figure out the stuff about starting cbq. Only I wanted the newer version. So I replaced the old one with a new version calling it cbq instead of cbq.init. Then it worked.

I did not know about the NAT problem. It gives me quite a problem because I want to make sure that 1 ip adress gets all the bandwidth it needs, when there is trafic to it. And it needs to be both upload and download. So I guess that I will have to try the MASK suggestion. I can not see anyother posibilities.

I thought that adding a "," at the end of the RULE address would do the trick. But some testing proved me wrong.

Thanks again. I will try your suggestion and give some feedback.

/Carsten

I forgot to mention, that I am using SME 6. I case it makes any difference.

lajgaard

Limiting bandwith for 1 lan ip
« Reply #16 on: December 15, 2004, 09:35:06 AM »
Hi everybody

I must say that the marking of packets works like charm. It limit my upload on the specific ip address.

That leaves only two questions:

1. Is the marking funktion very cpu demanding?

2. Can you remove the marks again?

/Carsten

Offline Appesteijn

  • ***
  • 62
  • +0/-0
Limiting bandwith for 1 lan ip
« Reply #17 on: December 15, 2004, 09:45:56 AM »
Quote from: "lajgaard"
Hi everybody

I must say that the marking of packets works like charm. It limit my upload on the specific ip address.

That leaves only two questions:

1. Is the marking funktion very cpu demanding?

2. Can you remove the marks again?

/Carsten


Nice to hear!
1. I don't know, but the time I used it, no high CPU usage occured.
2. You can remove the complete line ofcourse. Or may there exists '--del-mark'. I'm not sure.
............

Offline sebahot

  • *
  • 19
  • +0/-0
    • Drake Systems
Limiting bandwith for 1 lan ip
« Reply #18 on: April 10, 2005, 02:37:16 AM »
Finally I have make it work on my SME 6.0.1 server.
For upload shaping I used the mark option in iptables.
The files look like this:

FILE1
-------------------------------------------
This file is called cbq-80.eth0_down
-------------------------------------------

DEVICE=eth0,100Mbit,10Mbit
RATE=80Kbit
WEIGHT=8Kbit
PRIO=5
RULE=10.38.1.10
------------------------------------------


FILE2
------------------------------------------
This file is called cbq-80.eth1_up
------------------------------------------

DEVICE=eth1,100Mbit,10Mbit
RATE=80Kbit
WEIGHT=8Kbit
PRIO=5
MARK=10
------------------------------------------

For marking packets in iptables I've used this command:
iptables --table mangle -A POSTROUTING --out-interface eth1 --source 10.38.1.10 -j MARK --set-mark 10

The problem is when I put more than 1 RULE or MARK in one of these 2 files the 80Kbit bandwidth is shared to those IP's, not each one of them take
80Kbit bandwidth.


If you can tell me what is wrong I will much appreciate.

Best regards,
Sebastian
...

Offline Appesteijn

  • ***
  • 62
  • +0/-0
Limiting bandwith for 1 lan ip
« Reply #19 on: April 10, 2005, 01:53:45 PM »
And when you make 2 seperate files? So:

------------------------------------------
This file is called cbq-80.client1-eth1_up
------------------------------------------

DEVICE=eth1,100Mbit,10Mbit
RATE=80Kbit
WEIGHT=8Kbit
PRIO=5
MARK=10
------------------------------------------
And

------------------------------------------
This file is called cbq-80.cleint2-eth1_up
------------------------------------------

DEVICE=eth1,100Mbit,10Mbit
RATE=80Kbit
WEIGHT=8Kbit
PRIO=5
MARK=11
------------------------------------------

The problem with CBQ is that it is static. So the RATE is the max for this class and unused bandwidth is unused. Another traffic-shaper is HTB which is able to  lend and borrow unused bandwidth from different classes. Unfortunately HTB isn't compiled in the SME-kernel.
............

Offline sebahot

  • *
  • 19
  • +0/-0
    • Drake Systems
Limiting bandwith for 1 lan ip
« Reply #20 on: April 10, 2005, 05:01:04 PM »
I've maked separate files for each IP and MARK.
But it's the same.
I would like each ip in range 10.38.1.10 - 10.38.1.45 to have their download bandwidth limited to 80kbps and upload bandwidth limited to 80kbps, like that:
10.38.1.10 download 80kbps, upload 80kbps
10.38.1.11 download 80kbps, upload 80kbps
10.38.1.12 download 80kbps, upload 80kbps
......
10.38.1.45 download 80kbps, upload 80kbps

But if I put all ip's in one file or each ip in a separate file they all get shared 80kbps bandwidth (80kbps divided to 36 for each of them). The same is happening for download an for upload shaper.
As I read on different forums I have to declare some classes to CBQ with parents and childs, but I don't understand how this can be done.

I have the following config:
SME server 6.0.1 server-gateway mode
eth1 external nic (Internet)
eth0 internal nic (LAN)

1024/1024 kbps internet bandwidth

internal network 10.38.1.0/24

Please help me with this if you can.

Best regards,
Sebastian
...