You are not logged in.

#1 2006-04-13 03:28:58

_will
Member
Registered: 2004-07-08
Posts: 123

throtteling tcp

in this house we share a cable connection, and the others in the house are quick to complain when i suck up all bandwidth on newsgroups or uploading with DC
are there any utilities to limit in and out traffic

i've looked at tc, but it seems to be used for 2 devices (eth0 and 1) in addition to not looking like the friendliest creature in the linux world
im hoping to find a way to cap my lonely eth0 interface from hogging the small pipe we share

any ideas?

thanks
will

Offline

#2 2006-04-13 07:17:13

Neuro
Member
From: Poland
Registered: 2005-10-12
Posts: 352

Re: throtteling tcp

It depends on what you want to do. If you want to control the inbound and outbound traffic of only your machine, then you just need to place limiting queues on your eth0 interface. Just a root queue with a simple rate limit should suffice. Keep in mind that by doing that you'll also limit your LAN connection and won't be able to use the whole bandwidth if no one else is using it.

However, if you have a router/firewall machine running Linux/*BSD, you can shape the traffic for all host in your network. That way you can split the bandwidth equally and fairly between all users, and, if one of the users isn't using the connection, his share is split between the others. Additionally you can prioritize traffic (for example ssh, pings and http go with to priority and p2p goes through with least priority).

However that requires some tweaking and network knowledge. I don't know any ready-to-use script solutions. I made my own custom rules, but I can say that this howto helped me immensely.
http://lartc.org/howto/lartc.qdisc.html

Offline

#3 2006-04-13 21:00:41

_will
Member
Registered: 2004-07-08
Posts: 123

Re: throtteling tcp

thanks for getting back to me

the link provided to be helpful, i think i want to

tc qdisc add dev eth0 root tbf rate 100kbit latency 50ms burst 1540

but..tc is part of the kernel, and not in 2.6.16.4-1?
maybe i need to reboot
edit: reboot after downgrading to current kernel, no luck

also, this can be undone with the following?

tc qdisc del dev eth0 root

thanks
  will

Offline

#4 2006-04-14 06:12:39

IceRAM
Member
From: Bucharest, Romania
Registered: 2004-03-04
Posts: 772
Website

Re: throtteling tcp

$ pacman -Qo /usr/sbin/tc
/usr/sbin/tc is owned by iproute 041019-1

I am also trying to do this in my LAN. I've read tons of webpages about this and concluded - I can only easily limit the outgoing packages, not the incoming ones (since they were already sent).

Even so, if you drop incoming packages, the remote source of packages might detect this and throttle down (not sure about this though).

Also, there's a special qdisc for incoming packages named "ingress" (if I'm not mistaken). The commands you posted above are for setting a qdisc for outgoing packages.

I've also tried limiting the outgoing packages through my LAN interface (the one connecting to the computers in my LAN), but this doesn't work quite right (everything gets limited in my case - I believe it has something to do with flagging packages, since I only want to limit DC++/BitTorrent transfers).

Good luck. I will try further when I have time.

Offline

#5 2006-04-14 07:39:06

Neuro
Member
From: Poland
Registered: 2005-10-12
Posts: 352

Re: throtteling tcp

IceRAM wrote:

I am also trying to do this in my LAN. I've read tons of webpages about this and concluded - I can only easily limit the outgoing packages, not the incoming ones (since they were already sent).

This is true. Shaping the ingress traffic can be painfull. This is caused by the simple fact, that although you wish to limit/drop the packet that has been sent to you, it already went down the pipe to you saturating your connection.

Even so, if you drop incoming packages, the remote source of packages might detect this and throttle down (not sure about this though).

.
Still, shaping incomming traffic is useful, if you, for example want to share equally the bandwidth between madmax downloaders wink. The TCP protocol has transmission control, which is useful in these situations. If you drop a transmission packet (for example due to overflowing your queue or a connection problem), it'll be resent, because the sender won't receive a confirmation packet from you, that you had received it.

Also, there's a special qdisc for incoming packages named "ingress" (if I'm not mistaken). The commands you posted above are for setting a qdisc for outgoing packages.

I've read some papers, sites and scripts which all which all say ingress queues are evil. Instead, if you have a dual-homed router (one interface for the internet one interface for your lan), shape the egress of the internal interface.

I've also tried limiting the outgoing packages through my LAN interface (the one connecting to the computers in my LAN), but this doesn't work quite right (everything gets limited in my case - I believe it has something to do with flagging packages, since I only want to limit DC++/BitTorrent transfers).

Well, everything will get queued. You see, if you set up a egress queue on your internal interface, every packed going out through it, even if it was sent by the router, will get queued. If you only want to limit DC++/BitTorrent, you need to set up a subqueue in the rootqueue of your interface. Set the rootqueue's rate to almost the maximum of what your hardware can give you (99Mbps), and the subqueue to what you want it to be limited to (for example 256 kbps). Then you of course have to flag packages either in iproute's filters or iptable's MARK chain.

Offline

Board footer

Powered by FluxBB