7

Setting up a Tor relay on a VPS/cloud is a relatively straightforward process, which is great for people who enjoy that warm-fuzzy-i'm-making-a-difference feeling we get by contributing bandwidth to the network. However, most providers have a monthly limit on how much bandwidth you can contribute before charging extra, and that's something most of us would like to avoid.

Luckily torrc includes a really handy setting called AccountingMax that will cause your relay to go into hibernation when you hit a certain limit. With a 1000GB/mo VPS plan you could set a conservative monthly limit of 900 GB (or a daily limit of 30 GB) and Tor will automatically stop serving well before you dip into extra costs.

The only downside to this is that your relay won't be very stable. For a certain amount of time every day/month your server will be idle, thereby limiting the amount of consistent help you can contribute. I've used the RelayBandwidthRate setting to limit my bandwidth in an attempt to find a balance where I'm always relaying but never going over my limits. However, as throughput rates tend to fluctuate I'm not really sure if my settings are optimal.

Is there an easy way to determine what AccountingMax / RelayBandwidthRate / RelayBandwidthBurst settings are optimal for a given monthly cap? Would traffic ever be consistent enough to to come up with a simple table that could be included in the setup guide?


tl;dr

Essentially I'm looking for something like this:

Tor optimal bandwidth table

4

You should set your RelayBandwidthRate to the monthly cap divided by the number of seconds in a month divided by 2. (The 2 is because all traffic you relay goes in and out, so it counts twice.) To be conservative, I assume 1G for the provider is 10^9 and that 1K for Tor is 1024, that would be:

 500GB -  91 KB
1000GB - 182 KB
2000GB - 364 KB
4000GB - 792 KB

At these rates, you should never hit your AccountingMax and never hibernate.

Your RelayBandwidthBurst should be the amount of bandwidth you have to spare, so if you use this VPS exclusively for Tor, then all of it. If your upload and download speed are different, then use the lower of the two. But on a VPS it is probably symmetrical.

If you see little use, you could ramp up your bandwidth rate until hibernation kicks in. But it can take a long time to see the effects of changing settings and they can be unpredictable.

As far as I know, there is no way to dynamically adjust your bandwidth rate to what you have left for the month.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.