7

I have Tor set up on a Raspberry Pi dedicated to just Tor. I provide what bandwidth I can during the day so that it doesn't interfere with my online activities. I would like to provide most if not all of my bandwidth when I am offline, as I'm not using the bandwidth at that time.

I don't know anything about the proper syntax or if it's even possible to implement this as an option.

My thinking is something like

RelayBandwitdhRate 100 KB From 6am to 8pm
RelayBandwidthBurst 200 KB From 6am to 8pm

RelayBandwitdhRate 200 KB From 8pm to 6am
RelayBandwidthBurst 400 KB From 8pm to 6am

If this option can be implemented, then a logical extension of this option would be more bandwidth when idle.

For those people that host relays on machines they use, have a timer setting (like screensavers have) when the computer is idle for X-amount of time then Tor is allowed to use more if not all bandwidth.

6

A similar method to what Jens Kubieziel♦ already mentioned is not completely restarting the server, but using Tor's ControlPort to change the bandwidth limits at certain times of the day.

This can be achieved by the following cronjobs:

0 6 * * * echo -en "authenticate\r\nsetconf relaybandwidthrate=100000 relaybandwidthburst=200000\r\nquit\r\n" | nc localhost 9051
0 20 * * * echo -en "authenticate\r\nsetconf relaybandwidthrate=200000 relaybandwidthburst=400000\r\nquit\r\n" | nc localhost 9051

This way Tor will remain running, no restart of Tor is needed.

0 6 * * * means the the minute 0 of the 6th hour of the day (so 6am) and 0 20 * * * the 20th hour (20 - 12, cause PM is 8, so 8am).

The idle setting might be harder, because how much bandwidth is often unrelated to people sitting in front of the computer. Web surfing, as long as you don't stream videos or something like that often requires way less bandwidth than a download for example and while people download something it might be that they leave their computers. Tor would need a way to find out what the currently available bandwidth is, which can be hard. Different users have have different behaviors and to cover them all or at least a major portion can be tricky, also you may not want to decrease your limits, if you just have a small spike (e.g. because a Youtube video is loading).

Another problem is the connection limit, because of the available network connection or the amount of RAM or CPU-power provided by the system. For that MaxAdvertisedBandwidth might be set lower, which in case of a Rapberry Pi behind a quick network might make sense. If you set this option to a lower value you still provide the same amount of bandwidth, but have fewer users connecting to your relay, which might lower RAM usage and provide a better experience for people conning through your relay.

1

You can create two torrc files and make your settings in each one. Now set up a cronjob which stops one process and stops the other:

> crontab -l
# m h  dom mon dow   command
00 06 * * * service tor-fast stop && service tor-slow start
00 20 * * * service tor-slow stop && service tor-fast start

The above-mentioned case uses the initscript. There are two file (tor-fast and tor-slow) which reference the correct torrc.

The dynamic approach could be done with QoS (quality of service). You need a special software and need to prioritise your traffic. Tor should have a lower priority in your case. When there is some traffic, this is preferred and when there is none, Tor can use the whole bandwidth.

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.