# Bandwidth limiting on a LAN

## Anquietas

Hello,

I have a Linux Box running Gentoo which is a gateway (acts like a router), dhcp, iptables, bind installed.. etc...

Every station in the LAN uses this Linux box as a gateway.

I want to implement an EASY or DIRECT solution with which I can limit the bandwidth on the "Postrouting" mode (Incoming+Outgoing traffic for and from the LAN stations).

For example:

I want the LAN stations to be limited to 1 Mb/s instead of 8 Mb/s, which is the full capacity of the bandwidth of my server in external testings.

Please guide me to a solution (which I can understand), TCL / HTB or direct iptables mangle command, whatever, something I can understand and put in practice for limiting my LAN stations' net speeds.

Thank you.

----------

## gerdesj

Not much to go on here - do you mean limit each PC to 1MBs-1 or all of them?

I did a quick Google (other search engines exist) and found this:

http://www.linuxquestions.org/questions/linux-server-73/applying-download-speed-limit-iptables-842906/

Read it, follow up on the advice given and post back if you have any more specific questions.

Cheers

Jon

----------

## Anquietas

Yes, but I don't understand a thing...

So, I've instaleld HTBInit, it works...

I have a couple of files:

eth1  eth1-2.root  eth1-2:3.computer1  eth1-2:3.comptuer2  eth1-2:3.computer3  eth1-2:3:30.def  eth1-2:4.remote 

How must I arrange them or what should I type in them to achieve Limiting to 1 Mb/s for each of my computers in my LAN ??

Please help, I only found documentation for limiting Upload... I need for Download & Upload (full bandwidth limiting for my LAN Clients).

UPDATE:

I see that limiting in eth1-2:3:30.def works... however, I understand that this is an exception file and it limits everything... if my rules do not match the above files.

Please help me to make my rules properly in the htb files, I want diferentiated limiting based on IPs of the LAN Stations !

----------

## eulogious

I hate say it, but you've got a long road ahead.  If you didn't understand what was in the post that was linked to above, then you need to sit down and do some serious reading of the manual.  I have managed to limit my upload, and that took several weeks of reading, trying things and asking the right questions here before I got it, and I still don't really understand it.  The download is a little more problematic, and I never bothered to try it.

If you do understand the principals that iptables works on, there is no real way that you will be able to setup your network they way you want, so I really suggest googling iptables and reading how the packets flow, and understand the different commands and how they affect the flow of traffic.  Once you do that, some of the pieces should fit together, at least they did for me.  I am not being an ass here, I am just telling you what I have done, and I am still learning and it's been several years since I started this project  :Laughing: 

Here's a good start.  My QoS solution is posted in there, so that should give you something to go after...

https://forums.gentoo.org/viewtopic-t-671336-highlight-iptables+firewall.html

Hope that helps.  I can try to help you where I can, but I am by no means an expert!

----------

