Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: foobar on February 16, 2010, 12:35:25 AM



Title: Setting up multiple bitcoin machines behind NAT
Post by: foobar on February 16, 2010, 12:35:25 AM
Hello,

well the title says it all. I want to set up multiple bitcoin machines behind NAT.
For this it reason would be nice, if one could choose an other port than 8333, which I guess would have other nice side effects. Maybe someone uses this port for something else or maybe it isn't possible to set up port forwarding to this port for one reason or another.

Or is there an other way one should go?

Greetings,
foobar


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: satoshi on February 16, 2010, 01:34:56 AM
Right now there isn't a port number setting to do that.  It's a feature yet to be implemented.  You can only set up your NAT to port-forward to one of the computers.  (I said something earlier about NAT port translation, but that wouldn't work, other nodes wouldn't know to connect to that port)

If you want, as a small optimization, you could run the rest of your computers as:
bitcoin -connect=<the IP of the first computer>

so they get all their network communication from the first computer and don't all connect over the net individually for the same information.  This saves bandwidth, although it doesn't use much bandwidth to begin with, so it wouldn't really matter unless you had tons of computers.

For redundancy in case the first computer goes down, you could have two that connect out and the rest connect to both of them.  The first two are run normally, the rest are run like:
bitcoin -connect=<IP1> -connect=<IP2>


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: Xunie on April 08, 2010, 08:06:37 PM
Right now there isn't a port number setting to do that.  It's a feature yet to be implemented.

So, if I somehow I forwarded port router:8333 to bitcoinhost1:8333 and router:8334 to bitcoinhost2:8333, we get undefined behavior?
Because that seems like trivial to me, to keep track of port numbers in any p2p app.


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: satoshi on May 16, 2010, 11:56:03 PM
At the moment, it always assumes the incoming port is 8333, so it would tell other bitcoin nodes to connect to router:8333 even if you're redirecting from another port number.

I'm not in a big hurry to fix this because I can't think of any benefit to having more than one incoming connection port.  If you're providing one incoming port, then you've done your bit to help the network.  Having two incoming ports to the same person doesn't help redundancy.

If you have many computers, then using the -connect switch on most of them to connect locally makes more sense.


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: Xunie on May 17, 2010, 07:11:08 PM
Right now there isn't a port number setting to do that.  It's a feature yet to be implemented.

So, if I somehow I forwarded port router:8333 to bitcoinhost1:8333 and router:8334 to bitcoinhost2:8333, we get undefined behavior?
Because that seems like trivial to me, to keep track of port numbers in any p2p app.

Sorry about that, must've been drunk when I wrote that. ???


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: SmokeTooMuch on October 11, 2010, 09:47:27 PM
Sorry for digging out this thread, but what if I have two machines running bitcoin behind a NAT, port 8333 forwarded to one of these and both bitcoin clients are generating coins. Is the "unforwarded cleint" even able to generate coins ? Do they get send to the forwarded client ?


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: BitLex on October 11, 2010, 09:55:30 PM
they'll both generate,
only difference is the number of connected nodes, it'll be limited to 8 on all un-forwarded clients.


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: BlueBird on February 27, 2011, 03:00:39 AM
I have two copies running on two computers behind the same router with both systems pointing to the same 8333 port.  Only one computer gets more than 8 connections, but why cant both systems use the same port? 

P.S. If anyone wants to generate a transaction or two they can send .01 to  1C4eBje7vpxuE2deewfiNj8zgoiF4jpV4C    I will send it back at you, provide me your address.  Have fun!

Jim   :)


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: FooDSt4mP on February 27, 2011, 05:48:47 AM
I have two copies running on two computers behind the same router with both systems pointing to the same 8333 port.  Only one computer gets more than 8 connections, but why cant both systems use the same port? 

P.S. If anyone wants to generate a transaction or two they can send .01 to  <a href='bitcoin:?addr=1C4eBje7vpxuE2deewfiNj8zgoiF4jpV4C' id='lnk01C4eBje7vpxuE2deewfiNj8zgoiF4jpV4C'>1C4eBje7vpxuE2deewfiNj8zgoiF4jpV4C</a>    I will send it back at you, provide me your address.  Have fun!

Jim   :)

Both systems can't receive messages from the outside network.  The router can only forward the packets coming in on port 8333 to one of the computers.  However, if the two are connected to each other (which you can ensure with the -connect option mentioned above), the messages will be forwarded to the other node by the one that does receive it.


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: Dominic Sayers on May 18, 2011, 12:07:13 PM
You can only set up your NAT to port-forward to one of the computers.

<snip>

For redundancy in case the first computer goes down, you could have two that connect out and the rest connect to both of them.  The first two are run normally, the rest are run like:
bitcoin -connect=<IP1> -connect=<IP2>

I agree with the first statement (you can only forward the port to one computer).

Therefore I do not understand the second statement. How does this achieve redundancy? Only one of the two will receive forwarded traffic. If that one goes down then you've lost the connection (AFAIK).

Am I being dumb?


Title: Re: Setting up multiple bitcoin machines behind NAT
Post by: krepta3000 on June 26, 2011, 02:04:40 PM
You can only set up your NAT to port-forward to one of the computers.

<snip>

For redundancy in case the first computer goes down, you could have two that connect out and the rest connect to both of them.  The first two are run normally, the rest are run like:
bitcoin -connect=<IP1> -connect=<IP2>

I agree with the first statement (you can only forward the port to one computer).

Therefore I do not understand the second statement. How does this achieve redundancy? Only one of the two will receive forwarded traffic. If that one goes down then you've lost the connection (AFAIK).

Am I being dumb?

I can think of how it can be redundant, if the second connect command is connecting to a known, usually running, node Outside your own network, a public IP address.  There, redundancy achieved.