How to: Improve uptime of TOR nodes

Place for guides, manuals and other tips.
Post Reply
User avatar
Wiredancer
Jr. Member
Posts: 81
Joined: 28 Aug 2021, 05:01
Location: New Zealand
URL: https://lntxbot.com/@wiredancer
Contact:

How to: Improve uptime of TOR nodes

Post by Wiredancer »

As most node operators learn quickly uptime is quite important when it come to running routing node.
Uptime is one of few main criteria to be considered good node both by Lightning Terminal and BOS score.

As myNode have quite frequent updates and they take quite a bit of time, to keep your uptime above 99,9% is indeed a challenge.

Two ways I improved my uptime quite significantly are.

1. Turn off tor stream isolation.
Stream isolation creates separate circuit for each connection improving privacy, but with hundred or more channels it keep having issues, disconnecting and loosing both peers and channels. Also after the node is restarted it may take up to hour before all channels come back online. All of this will reduce your uptime. By turning off isolation all your channels will connect immediately and I haven't experience any downtime at all from my side. That being said I don't understand how big is the trade off for the privacy and I will update this guide once I learn more about this.

To turn off stream isolation go to your lnd.conf and change the setting to false/0. Restart will be required.

Code: Select all

tor.streamisolation=0
2. Use BOS reconnect every hour to try to re-establish any dropped peers / channels.
If you setup crontab to run reconnect every hour, it will make sure to re-establish connections as soon as possible thus increasing your channel uptime!

First make sure your BOS is installed properly and see the location system is using

Code: Select all

which bos
Usually it should be at /usr/bin/bos if the location is different you will need to put it correctly in the crontab entry. (Crontab is Linux scheduler where you can setup commands / jobs to be done in certain intervals).

Open crontab as your current user (probably admin, sudo is not needed):

Code: Select all

crontab -e
Scroll all the way down and add (this will run every hour reconnect command):

Code: Select all

0 */1 * * * /usr/bin/bos reconnect
(if your BOS path was different, make sure you use correct path)

If you want to monitor it is working properly you can make the output to be written to the file, if that is the case just add redirect to file at the end. This will create file reconnect.log in your /home/admin and every hour writes latest reconnect output and or error.

Code: Select all

0 */1 * * * /usr/bin/bos reconnect > /home/admin/reconnect.log 2>&1
Note that you can change frequency of the command by changing first five * * * * * as per Crontab guru

With this two settings your node will increase its uptime even when running solely on TOR!
Please let me know if I have any mistakes, something is not working or if you have any more questions.

Happy routing.
Did you find my post helpful?
Why not send me few sats?
:arrow: Get LN QR code.
Happy routing!
Post Reply