Linux traffic shaper setup advice
On Monday 09 February 2009 12:34:01 Aleksey V. Kunitskiy wrote:
> Hi Gentoo community,
> I have several computers at home and one Gentoo-powered router. I want to
> setup a very simple traffic shaper that will give each computer almost
> equal(the best choice - with some weight coefficient on each ip address)
> speed, without counting number of connections and etc. So, someone using
> torrent won't load whole pipe. One most important problem with it that I
> have fixed speed to the world and fixed speed to local resourses in my
> city, so I can't fix my up/down link speed to one fixed number, I actually
> have 2 speeds, depending on the IP address I'm accessing to.
> Any suggestions?
First, when you say you have a "Gentoo-powered router," what exactly do you
mean? Are you running a dedicated hardware router where you've installed
Gentoo or are you using a PC with multiple NICs as a router? This may or may
not be important, depending on exactly what you end up implementing.
Personally, I'd recommend using purpose built router software, such as DD-WRT
or Tomato. They're Linux based but they're specifically customize for routing
and are probably going to be much easier to configure, and they run on a lot
of different commercially available hardware. A $50 Linksys WRT54G with DD-
WRT can match a $1000 Cisco router in capability and performance in many
Second, how familiar are you with networking in general and traffic shaping in
particular? If I'm understanding you correctly, what you're trying to do
above would be difficult and quite inefficient. For example, if you do a hard
limit on bandwidth per IP, then much of your capacity will be idle because
it'll be reserved for systems which aren't using it. For example, if system A
is downloading a file, it would be restricted in speed if bandwidth is being
reserved for systems B, C, etc., even if no one is using those systems! So
unless all of your systems are in use maxing out their allotted bandwidth at
the same time, you're always going to have bandwidth that is sitting idle.
That's quite inefficient.
If your goal is to ensure that a bittorrent download on one system doesn't bog
down a VoIP call or a WOW gaming session on another system, then you'd be much
better off going with some sort of CBQ (Class Based Queuing.) This won't put
a hard limit on the bandwidth usable by any particular system or IP, but it
will prioritize traffic and prevent bittorrent, etc. from clobbering all your
There's a good introduction to traffic shaping with Linux here:
Note that manually configuring traffic shaping with iproute2 can get quite
technical and require some indepth rule writing. Depending on your level of
knowledge and the time and effort you're willing to put in, that may or may
not be an issue.