Just to preface this, I'm a little new to networking and Ethereum in general, but after looking through some tutorials, I decided that I would like to create a private network/blockchain for my own use and smart contracts. But while I can connect 2 peer nodes on the same machine, I have difficulty connecting 2 peer nodes on different machines.
METHOD 1: The below is one way I've tried this (which works for 2 peers on the same machine; one tutorial I saw had the last 3 flags missing but I decided to include them anyway)
geth --datadir /path/to/genesis --networkid 111 --maxpeers 2 --rpc --rpccorsdomain "*" --nodiscover --ipcdisable --rpcport 30001 --port 8081 console //machine 1
geth --datadir /different/path/to/genesis --networkid 111 --maxpeers 2 --rpc --rpccorsdomain "*" --nodiscover --ipcdisable --rpcport 30002 --port 8082 console //machine 2
And then on machine 1 obtain admin.nodeInfo.enode (which is"enode://d677...b4c5@[::]:8081?discport=0"), and enter on machine 2 admin.addPeer("enode://[email protected]?discport=0).
This returns true but admin.peers remains empty.
METHOD 2: Another way is to do the same thing for machine 1, but instead on machine 2 type:
geth --datadir /different/path/to/genesis --networkid 111 --maxpeers 2 --rpc --rpccorsdomain "*" --nodiscover --ipcdisable --rpcport 30002 --port 8082 --bootnodes enode://[email protected]?discport=0 console
And then do the same admin.addPeer process. Same results happen, however.
I'm really torn as to what is the problem here. The genesis blocks are the same (hashes are the same), and I've tried various types of flags after initializing on both machines. I suppose my hunch is that my clocks are not synced on both machines (although I'm not sure how to do so other than sudo timedatectl set-ntp on), or that I'm not entering the right IP address (although I've tried almost all of them), so maybe some direction in these areas would be nice.
I've tried having --verbosity 6 also, and the error returned is 'discovery is disabled' and 'dial tcp my.ip.address:8081: getsockopt: connection refused'. Which is strange since I had no problem doing this using the same machines, but when I did the same thing without --nodiscover it still didn't work: errors were 'dial tcp my.ip.addresss:8081: i/o timeout' and 'no discv4 seed nodes found' and 'resolving node failed'.
I'm really sorry if this is really long-winded but it's just I'm really unsure of what's the real problem and I've been just iterating through much of these changes that I'm sure about. To make matters worse I think Ethereum and geth are constantly updating so I'm not sure if the information I'm seeing on this site and elsewhere are relevant or accurate. I'd really, really appreciate some help here because I'm really desperate for some help and clarification.