I have a 64MB/s internet connection and it should be divided among 17 LANs with a priority. Any computer from any LAN should have a particular share from bandwidth (For example computers from LAN1 have half of bandwidth that computers from LAN2) but it's share should vary when overall internet load varies.
So the allocated bandwidth should not be given statically and must be changed according to the load.
I tried Squid and iproute. But as far as i found, none of them could allocate bandwidth dynamically. They just could give an IP a static bandwidth (say 64kbps)
UPDATE:
As Crankyadmin, carson and David Bliss said, there are three ways to do this:
As i found, all of them are solutions for this problem. But i don't know if one is suitable for high loads and can manage hundreds of Computers.
I am using FreeBSD as a proxy server so it's nice to have a solution that works on FreeBSD too.
So I need a FreeBSD compatible solution that can deal with high load. it should be efficient and fast) and doesn't waste the internet bandwidth.
A combination of the BSD pf packet filter and ALTQ should enable you to allocate dynamically network bandwidth. The OpenBSD documentation includes an example configuration for the following situation:
On FreeBSD the pf packet filter is available as a loadable module, or can be compiled into the kernel. ALTQ is also available on FreeBSD, but only by being compiled into the kernel.
You may want to checkout pfSense
You should be able to do this using something like Shorewall. Check out the section on traffic shaping. Look at the "Using builtin traffic shaping/control" section and then RATE. You should be able to give each LAN a minimum and maximum rate then prioritize each. If the pipe is idle everyone will get what they want but as it fills up the higher priority LANs will push out the lower priority LANs.