Bitcoin Forum
May 24, 2024, 07:02:33 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Two bitcoin clients behind NAT  (Read 2870 times)
hazzey (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
April 07, 2011, 04:32:20 PM
 #1

In my situation, I have two separate computers running the bitcoin client.  One has the firewall/NAT forwarding port 8333 to it and the other one is just behind the NAT.

What happens with the list of addresses that the network passes around?  My thinking is that since both of my computers appear to have the same global IP address, they are assumed to be the same computer. 

As an example, the NAT'd client connects out to its 8 other clients.  The NAT'd client's IP address gets added to the list of address that gets shared. When that address gets passed to another client that wants to connect, that client tries to connect to the IP address that it has.  Since the firewall/NAT forwards port 8333 to my second client, this client then receives the connection attempt and processes it.  The outside bitcoin client doesn't know the difference and is happy.

Is that how it would work?

This doesn't really make too much difference in the end, because the NAT'd client would only have ever connected out its 8 times anyway.  Would this in some way increase the number of connections that the port forwarded client gets?

My additional thought is that once the addresses of my two clients (they are the same IP) get passed around, they merge into one anyway and they client that has the port forward basically "becomes" the both of them.

Thanks for any of your thoughts.

Hazzey
Matt Corallo
Hero Member
*****
expert
Offline Offline

Activity: 755
Merit: 515


View Profile
April 07, 2011, 05:17:32 PM
 #2

Please, dont wast network resources having two clients connect outside of your network.  The best way to do this is to run one client with the proper port forwarding, and then the second using the -connect= parameter, which limits connections to that particular peer (add your main node's local IP).

What happens with the list of addresses that the network passes around?  My thinking is that since both of my computers appear to have the same global IP address, they are assumed to be the same computer. 
Yep, pretty much.

As an example, the NAT'd client connects out to its 8 other clients.  The NAT'd client's IP address gets added to the list of address that gets shared. When that address gets passed to another client that wants to connect, that client tries to connect to the IP address that it has.  Since the firewall/NAT forwards port 8333 to my second client, this client then receives the connection attempt and processes it.  The outside bitcoin client doesn't know the difference and is happy.
Yea, in theory it should work just fine, you would be connecting to the other node on your network, no problems.  In reality, this would probably never happen (I dont think there is any "connecting to myself" checks, but I don't know) as there are so many nodes.

My additional thought is that once the addresses of my two clients (they are the same IP) get passed around, they merge into one anyway and they client that has the port forward basically "becomes" the both of them.
Yea, pretty much.

Bitcoin Core, rust-lightning, http://bitcoinfibre.org etc.
PGP ID: 07DF 3E57 A548 CCFB 7530  7091 89BB B866 3E2E65CE
hazzey (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
April 07, 2011, 05:59:51 PM
 #3

Please, dont wast network resources having two clients connect outside of your network.  The best way to do this is to run one client with the proper port forwarding, and then the second using the -connect= parameter, which limits connections to that particular peer (add your main node's local IP).

Ok, first, how is this wasting network resources.  Are you meaning that the NAT'd client is pointless because it is only connecting to 8 other nodes?  If that is the case, isn't every NAT'd client a waste?

Second, if I have the NAT'd client connect to another client on my local network (e.g. 192.168.*.*) won't the client see that as an invalid address and do its normal thing anyway?

Thanks,

Hazzey
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5208
Merit: 13013


View Profile
April 07, 2011, 06:40:31 PM
 #4

You'll send double the number of addr messages, which could help addr propagation slightly. Sending more addr messages has diminishing returns, as peers around you will block your duplicate messages. The main bootstrap method is IRC, though, and having two nicks on IRC doesn't give you any advantage.

In any case, it won't cause any problem for you or the network, aside from unnecessary resource usage.

Second, if I have the NAT'd client connect to another client on my local network (e.g. 192.168.*.*) won't the client see that as an invalid address and do its normal thing anyway?

No.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!