<p>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.</p>

<p>Run the first one normally, and use <code>-connect=127.0.0.1:18442</code> on the second.</p>

CC BY-SA 3.0
2015-11-29T17:20:28.443Z
2015-11-29T17:20:28.443Z
Pieter Wuille
<p>You are going to want to modify the following two lines in the script</p>

<pre><code>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
</code></pre>

<p>Make one script with --dport 18441 --sport 18441 and another script with --dport 18442 and --sport 18442</p>

<p>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:</p>

<p>Instance1: 20 connections
Instance2: 20 connections</p>

<p>with a single instance you would have:</p>

<p>SingleInstance: 40 connections</p>

CC BY-SA 3.0
2015-10-31T05:47:39.160Z
I am specifically connecting only two nodes 18441 and 18442 with each other and not with the outer network of bitcoind.
bawejakunal
CC BY-SA 3.0
2015-10-30T13:36:27.157Z
2015-10-30T14:52:03.583Z
2015-10-30T14:52:03.583Z
Charles S
<p>The bitcoin github repo has a  bash script given to control the flow of outbound traffic by using the bash script given  on : <a href="https://github.com/bitcoin/bitcoin/blob/master/contrib/qos/tc.sh" rel="nofollow">https://github.com/bitcoin/bitcoin/blob/master/contrib/qos/tc.sh</a></p>

<p>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 ?</p>

<bitcoind><bandwidth>
Controlling bitcoind connection bandwidth
bawejakunal
# Controlling bitcoind connection bandwidth

(Asked by: username_0 on 2015-10-30)

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 ?

**Tags:** bitcoind, bandwidth


---

## 2 answers

### Answer by username_1 on 2015-11-29. Score: 1

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=127.0.0.1:18442` on the second.


---

### Answer by username_2 on 2015-10-30. Score: 0

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

> **Comments:**
> **username_0**: I am specifically connecting only two nodes 18441 and 18442 with each other and not with the outer network of bitcoind.  

---

