The bitcoin github repo has a bash script given to control the flow of outbound traffic by using the bash script given on : https://github.com/bitcoin/bitcoin/blob/master/contrib/qos/tc.sh

I am running two bitcoind instances on a local machine with different ports: 18441 and 18442, how do I make use of this script or tweak it, to control the connection bandwidth between the two bitcoind instances ?

2 Answers 2


If you're running two bitcoind instances on one machine, depending on the use case, you may instead be better off by connecting one to the other only, and not make it talk to the network. This will reduce the total bandwidth used significantly, as every block and transaction will only be fetched once.

Run the first one normally, and use -connect= on the second.


You are going to want to modify the following two lines in the script

iptables -t mangle -A OUTPUT -p tcp -m tcp --dport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2
iptables -t mangle -A OUTPUT -p tcp -m tcp --sport 8333 ! -d ${LOCALNET} -j MARK --set-mark 0x2

Make one script with --dport 18441 --sport 18441 and another script with --dport 18442 and --sport 18442

I do want to say though, as far as I understand it's not more efficient to be running two instances of bitcoind from one IP. You would just basically be splitting connections between the two instances when you could be running 1 instance that would have the sum of the connections in your current setup. Basically what you have right now:

Instance1: 20 connections Instance2: 20 connections

with a single instance you would have:

SingleInstance: 40 connections

  • I am specifically connecting only two nodes 18441 and 18442 with each other and not with the outer network of bitcoind. Oct 31, 2015 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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