# ALTQ define upload and download.



## Mr0wyx (Feb 24, 2010)

*Hello!*

I have transmission-daemon running on my router + NAS box 24/7. It is impossible to surf web or use voip from lan throw router while torrent is taking all bandwidth.

Is it possible to limit incoming (download) and outgoing (upload) speeds on same interface (for torrent) with ALTQ when I start surfing web from lan throw router?

*Thank you!*


----------



## Ruler2112 (Feb 24, 2010)

Upload, yes.  Download, no.  However, most torrent apps have a bandwidth limiting feature in them that you can set how much to use at max.


----------



## Mr0wyx (Feb 24, 2010)

*Thank you for your replay!*

As I understood from manuals I can limit in both directions, but not at once. And it should contain only one rule for interface. So if I have down speed ~6 MB/s and upload ~2 MB/s I have to choose which one to define on particular interface.

There is bandwidth limiting feature but what I want is to that router would set limitations automatically as I start to use other services. Maybe there are some alternative ways?


----------



## Ruler2112 (Feb 24, 2010)

If you're referring to limiting speed via your torrent app, you should be able to define your maximum upload speed and your maximum download speed separately.  If your specific app doesn't support this, you should look for another torrent client that does.

You can certainly use ALTQ to limit bandwidth usage.  However, limiting download speed is silly.  Consider - by the time your box knows that the download speed limit has been reached, the packets that exceed the speed are already at your box and have used your downstream bandwidth.  Therefore, the firewall will happily drop them, but the bandwidth has already been used.  The protocol is most likely TCP, so they'll be re-transmitted anyway, using still more bandwidth.  This is counterproductive to what you're trying to accomplish.

If you do decide to use ALTQ (which is a very effective way of limiting upstream traffic) you'll need to compile a custom kernel because the generic kernel that comes with FreeBSD does not include support for it.  You can have as many rules to shape the traffic as you need (within reason).  I currently have about half a dozen rules active on my mail server so that when somebody e-mails a 10 meg video to 20 people, the mail server still works instead of doing nothing but trying to deliver all the huge messages to their destinations.  Check the handbook for details and examples on how to create a rule set appropriate for your purpose.


----------



## Mr0wyx (Feb 25, 2010)

Thank you a lot! Now things are clear for me. I will only limit upload with ALTQ. The downloading takes less time than seeding. So it would be more reasonable to limit outgoing packets. In my case.

Thank you once again!

P.S. Really happy that this kind of community exists! :stud :beergrin


----------



## DutchDaemon (Feb 25, 2010)

You don't really need to 'limit' upload with ALTQ. A better way is to make bittorrent upload bandwidth the lowest priority, so other traffic will always push it down when bandwidth is needed.


----------



## Mr0wyx (Feb 25, 2010)

*DutchDaemon:*



> A better way is to make bittorrent upload bandwidth the lowest priority, so other traffic will always push it down when bandwidth is needed.



In what way you mean to do that? Limit upload rate by torrent client?

I want it to make it to limit automatically. So my seeding is always going at max rate (on router itself) until I start to use internet for other services from lan.


----------



## DutchDaemon (Feb 25, 2010)

That's exactly what ALTQ queueing is used for, whether it's CBQ, PRIQ or HFSC. Just give bittorrent traffic the lowest priority.


----------



## Mr0wyx (Mar 18, 2010)

Thank you! Solved!


----------

