Join 3,554 readers in helping fund MetaFilter (Hide)


Après toi, pas de déluge
January 17, 2012 12:03 AM   Subscribe

How can I limit bandwidth to Computer 1 when Computers 1 & 2 are connected to the internet? Port-forwarding, and BitTorrent.

Two computers, one router, home network. Computer 1 (c1) is connected to the router by ethernet cable, Computer 2 (c2) always connects by wifi. If it matters, I cannot switch the ways they connect to the router -- c2 lives in a distant room with no phone jack, so c2 must connect by wifi.

c1 is mostly always running BitTorrent, for which a port was forwarded. Ideally, c1 would continue to run BT all the time, but the traffic to and from c1 would slow to a crawl when c2 was online. Even more ideally, the throttling would only affect traffic via BT on c1, and web-browsing would be prioritized between the two computers... however that is done now. BitTorrent allows me to limit its traffic vs. web traffic on the same computer, but not on the local network as a whole, as far as I can see.

I know I could use the BT scheduler to run BT at selected times, but there is no real pattern to c2's usage.

In this scenario, I'm the torrenting roommate, and I want to limit (but not stop) my own available bandwidth when (and only when) the OP is online on her computer. Possible?

I was able to do the port forwarding thing, once I learned those words, so it will be very helpful if you can tell me the search terms I want for this.
posted by pH Indicating Socks to Computers & Internet (17 answers total) 1 user marked this as a favorite
 
You want traffic shaping or QoS (Quality of Service). I think a lot of recent Netgear routers can do this, but I'm sure others do also.
posted by wierdo at 12:16 AM on January 17, 2012 [1 favorite]


Oh, and I have admin rights on both computers and the router. c1 is a fast Windows7 desktop, c2 is a not-so-fast Windows7 laptop, and the router is ActionTec GT704WGB.
posted by pH Indicating Socks at 12:20 AM on January 17, 2012


Before messing about in the router, you might try limiting your upload bandwidth somewhat. In my torrenting experience, maxing out your upload messes things up far more than too much downloading. If you have 1 megabit upstream DSL, try doing no more than 768kbps of upload, or if you have 768, try 512 or a little lower.

Obviously, doing the traffic shaping in the router is better in that you're not letting bandwidth go to waste.

It does appear that router has QoS settings, but I don't have one and no screenies come up in a quick Google, so I can't give you any specific advice about how to do it.
posted by wierdo at 12:27 AM on January 17, 2012 [3 favorites]


Which BitTorrent client are you using? Or rather ...

Maybe one of the available clients has an interface that allows upload/download bandwidth to be changed programmatically. Then perhaps there is a utility out there that detects if a certain machine comes online on the local network, and maybe that utility can run a script that triggers changes in the upload/download bandwidth. This is all theoretically possible and not that hard to implement, with respect to programming the necessary components.
posted by krilli at 2:29 AM on January 17, 2012 [2 favorites]


Also, try limiting the global connection count in the torrent client (to maybe 100? experiment). Sometimes bit torrent isnt using all of your bandwidth, but it is really stressing your router with opened connections.

If that doesn't work however, it's time for QoS, as said above.
posted by utsutsu at 6:39 AM on January 17, 2012


I'm running the BitTorrent client, using Switeck's conservative settings. So I am limiting my UL bandwidth and global connections now, enough to give me reasonable web browsing on c1 while BT is running. However, c2 essentially cannot browse at all, when c1 is running BT -- which is all the time.

As it is, when c2's user wants to get online, she walks over to c1 and shuts down BT (or asks me to do that). There has got to be a more elegant solution, right?

So this QoS of which you speak...

I find that there are QoS Upstream Settings and QoS Downstream Settings um pages in my router's UI. If QoS Settings are enabled, there are Priority, Protocol, and Set DSCP rule parameters. There are Source and Destination IP, Subnet masks, and port ranges to which the rules are applied. But because I do not even know what noun I am trying to verb here, I don't know how to ask Google what goes in these fields.

This seems like what I want, this QoS. I'm so excited. But how to make it conditional between the computers -- traffic to c1 on Port 12345 (BT's port) is low priority only when c2 traffic (on Port 80? all ports?) is ? -- BUT c1 traffic on Port 80 does not affect c1 traffic on Port 12345.
posted by pH Indicating Socks at 12:34 PM on January 17, 2012


In addition to setting bittorrent to conservative settings, install DD-WRT on your router, set bittorrent traffic to bulk under the QOS settings.

The way QOS on home routers works is it looks for traffic matching certain criteria, and prioritizes OUTBOUND traffic based on that, and only when you're out of bandwidth. So computer 1 can use all your outbound traffic for bittorrent as long as you aren't using it for anything else.

You'll also want to set the maximum connections allowed in DD-WRT to 4096, because a lot of the slowness caused by bittorrent isn't actually from bandwidth, it's from bittorrent opening up more than the maximum number of connections your router is configured to allow, which holds up traffic.

QOS can't really do anything about about inbound traffic because by the time it gets to your router, it's already gone over the congested link, so any latency has already happened. There are some tricks that some high end routers can do to shape inbound traffic, but they don't work very reliably.
posted by empath at 12:43 PM on January 17, 2012


ActionTec GT704WGB is not supported by DD-WRT. :(
posted by pH Indicating Socks at 1:07 PM on January 17, 2012


empath wrote: QOS can't really do anything about about inbound traffic because by the time it gets to your router, it's already gone over the congested link, so any latency has already happened. There are some tricks that some high end routers can do to shape inbound traffic, but they don't work very reliably.

Luckily, TCP is designed to back off if ACKs are not received on time, which they will not be if the traffic shaping implementation is decent.

pHIS: It doesn't matter if BT priority is always low. The point is that c1's BT traffic needs to be lower priority than anything else. With that done, when nothing else is using the link you'll have (almost) full speed out of BT. As soon as other packets show up, they go in front of any waiting BT traffic.

All that said, if c2 can't browse at all, it may well be too many connections causing the problem. Generally a saturated connection will still work, it will just be awfully slow. If your BT client has download speed control, set both your upload and download savagely low and set maybe 20 connections max. If that gets you reasonable browsing on c2, bump things up a little at a time until you stop being able to browse on c2 and you'll find the right settings.

You'll likely need a new router if you want to do any better than that from the look of the Actiontec. I'm not even sure it does any traffic shaping itself, it may just be tagging traffic for other routers to take action on.
posted by wierdo at 1:41 PM on January 17, 2012


Along with any bandwidth throttling, also look into concurrent connections. Many commercial routers have a tough time keeping up with many concurrent connections, regardless of how much data they're pulling. About 20-50 concurrent should be a safe area, try changing it while in use to see if there's an impact on performance.
posted by samsara at 1:54 PM on January 17, 2012


Thanks to all who suggested modifying the BT settings on c1, but I am loath to do that -- c1 browsing, and BT, work great (after much tinkering). If I just could not use BT under my current settings while c2 was online, I'd just turn off BT. And that is what I do now.

Weirdo: It doesn't matter if BT priority is always low. The point is that c1's BT traffic needs to be lower priority than anything else. With that done, when nothing else is using the link you'll have (almost) full speed out of BT. As soon as other packets show up, they go in front of any waiting BT traffic.

OK! So at the router, one can set torrenting to low priority if one knows the BT listening port (for me, 12345). If one does (only) that, THEN any other network traffic takes priority over traffic on 12345, AND port 12345 is free to use the entire bandwidth in the absence of other traffic -- yes/no? HOWEVER this would prioritize any other traffic on c1 or c2 over port 12345 traffic -- yes/no?

My ideal solution, at the router:...and if possible, It seems like this would be a totally common thing for ordinary ignorant folks to want to do -- to limit bandwidth to a torrenting computer when another computer wants to surf on the same home network. Right? A huge number of people torrent, and (I would guess) many of them are on shared networks. I keep thinking there must be a [this thing] For Dummies guide somewhere.

All that said, if c2 can't browse at all, it may well be too many connections causing the problem. Generally a saturated connection will still work, it will just be awfully slow.

c2's user clarified her experience for me just now: it is just awfully slow.
posted by pH Indicating Socks at 2:54 PM on January 17, 2012


Well! Thanks to you, I seem to have what I want. I gave c2 higher priority than c1 at the router, and, this strangely, did not impair c1 browsing at all, and BT only a little.

I'll spell out what I did, and what effect that had, in case I'm right that legions of future Askers would want to do this thing -- and in hopes that you will tell me why it worked, because I don't know. (Or tell me that it only seemed to work because [reason], and what I and future Askers should do instead.)

Here is what I did: When it refreshed, it said, "Rule list: high: any 0.0.0.0/32 0 to [c2's IP]/32 0"

Test:c2 streaming and website-loading was fine, continuous.
BT went from about 90 kB/s upload to about 70 kB/s BT upload did not change.
c1 streaming and website-loading was fine, continuous.
Apparently better than before while running BT, which makes no sense.
posted by pH Indicating Socks at 4:30 PM on January 17, 2012


When you set c2's priority higher, you in essence told the router to send c2's traffic first if there are two packets waiting to go out. If c2 isn't exchanging any packets, this has no effect on c1's traffic. Since c2 isn't using much bandwidth, there's plenty left over for c1 to do whatever it likes with. If c1 is configured correctly, BT traffic is already a lower priority within c1, so browsing still isn't affected.

Prioritizing one thing necessarily deprioritizes all that which has not been prioritized.

Basically, you set it up to give c2 everything and c1 gets whatever is left over. So long as c2 isn't doing anything crazy, there's no need to go further. If you liked, you could set traffic to/from your BT port to low priority, which should keep c1's browsing responsive even in the case of a misconfigured BT client. In that vein, you should probably set a reciprocal rule to the one you already set that gives traffic from c2 to the internet high priority. As it is, you've given traffic to c2 high priority, but not the other way around.
posted by wierdo at 5:46 PM on January 17, 2012


Hmm..here's an analogy that might make it more clear. Network devices have what's called a buffer, which is essentially a bucket with a hole in the bottom into which all the packets waiting to be sent go into to wait their turn to leak out the bottom and get sent on. If you fill the buffer to overflowing, some packets can't fit and so they get dropped.

That's how things normally work.

With QoS, there is more than one bucket. Packets get sorted into their respective priority buckets. It's not quite precise, but you can think of it like the low priority bucket draining into the middle bucket and the middle into the high priority bucket which then "drains" into the network. The high priority packets go into the high priority bucket, so they immediately drain unless there's another high priority packet already in the bucket. Once the high priority bucket is empty, the other buckets can drain into it (and thence out to the network) until another high priority packet comes in.
posted by wierdo at 5:55 PM on January 17, 2012


Yes, that makes sense. I added Upstream QoS rule: "Rule list: high: any [c2's IP]/32 0 to 0.0.0.0/32 0".

Yay! Thanks, Weirdo! Hey, now that I have admined my sys, that makes me a YES. FEAR ME MORTALS. Where do you guys get your capes?

posted by pH Indicating Socks at 6:28 PM on January 17, 2012


Oh, cape is just an old bed sheet. :(

What makes me a real IT person is the wingless American Eagle jet mounted on top of my rack.
posted by wierdo at 6:59 PM on January 17, 2012 [1 favorite]


Luckily, TCP is designed to back off if ACKs are not received on time, which they will not be if the traffic shaping implementation is decent.

Right, but that ignores udp traffic. Like I said, it's hit and miss at best. If you really want QOS inbound, you need the ISP to implement it for you (not likely for a non-business account.)
posted by empath at 6:30 AM on January 18, 2012


« Older How does a person become a mec...   |  Brazil Filter: I'll be in Sao ... Newer »
This thread is closed to new comments.