We have a transparent proxy setup. I tried looking for traffic shaping in Linux, and all I could find online was to limit traffic by interface (eth0/eth1...).
I need to limit the bandwidth (never exceeding a specific limit) by IP address or IP ranges and I can't find a way to do that.
Is there any way to do that?
The traffic shaping layer of the kernel is, basically, a packet scheduler attached to your network card. So one traffic shaping policy applies to one network card.
What you can do, in your case, is to create a list of IP and bandwidth attached, and then, for each IP, you create:
The example given by @Zoredache works, but I personnally prefer to use Netfilter capability instead of TC to filter packets, and HTB instead of CBQ for the shapping algorithm. So you can try something like this (requires Bash 4 for associative arrays):
-- edit: forgot the default class and to propagate marks at the end of the script.
Something like this worked for me to limit a contractor's web cam to a limited amount of bandwidth. Check out the man page for tc for details.
I'm not sure I understand your question correctly.
Transparent proxying (as in Squid for HTTP) is used to control mostly incoming data. While traffic shaping is used to control outgoing data.
You need to provide more details. If you have a lot of workstations behind a HTTP proxy and are trying to limit their download speeds, you'd better go for something like Squid + delay pools.