On Sunday 17 August 2008 16:32:11 Steve wrote: > Norberto Bensa wrote: > >> Is there a straightforward way to make my Gentoo box 'play fair' and > >> not hog 100% of the bandwidth? > > > > If your router doesn't give you bandwidth and/or traffic shaping > > control, you can drop some packets. For example, the following rule > > will accept up to 50 packets per second and drop the rest. The TCP > > protocol will retry and slow down. > > > > iptables -I INPUT -p tcp -m limit --limit 50/sec -j ACCEPT > > iptables -I INPUT -p tcp -j DROP > > Hmmm - that would likely be rather aggressive - I use the router to > shift data between the two PCs at 100mbps - it is only the traffic > eventually routed over ADSL which poses a problem.
You could add a destination parameter with -d but that wouldn't catch any downloads of packages from other than your primary mirror, and I agree that this is not the correct solution anyway. > >> Does anyone else have this problem? > > > > Yes, everyone using TCP :) > > You can read Linux Advanced Routing and Traffic Control for more info > > (http://lartc.org/). > > Snappy answer... but I'm pretty sure I've never seen this before - on a > wide range of OS and network topologies. I didn't have the same problem > with two Windows PCs connected to the same router - and it is always the > Gentoo box that "wins" in the landgrab-war for bandwidth. This should happen. Absent any sort of Quality of Service mechanisms, TCP windowing should adjust so that all flows get a roughly equal share of bandwidth. Certain protocols, primarily p2p, will create multiple flows and so gobble up more than their fair share but even then you shouldn't get starvation to the point where DNS times out. Even if emerge were using bittorrent you shouldn't see that much congestion. > It might also be worth mentioning that the Gentoo box serves DNS for my > LAN - so, the DNS request will get from my Windows PC to my Gentoo box > without any problem... so, it is actually a fight between bind on gentoo > and the download of packages during emerge that pose my annoyance. I > wonder, is it likely relevant that named is running as an ordinary user > - while emerge is run as root? I'm not aware of any mechanism on Linux to set network priority based on the process owner. Linux does support QoS and various types of queues, so it might be possible to, say, set up a priority queue which would have the effect you're seeing. I'm not aware of any way to do queuing based on process owner but Linux is such a powerful and diverse system that no one is familiar with every aspect of it's capabilities. There's lots of stuff you can do that I'm not aware of. If it can be done, it certainly would not be the default setup of any sane package. It would be something you'd have to do yourself. > I also noticed that incoming emails to my postfix mail server timed out > during this period... "timeout after RCPT from extern.server.org"... > > It seems odd to me. It is odd, although unfortunately I'm not sure what to tell you as to how to go about fixing it. I think the first thing I'd do is to make sure that it really is congestion that's causing the problem. You could implement something similar to the iptables rule listed above temporarily and see if that causes the symptoms to change or disappear.