How to know my ip address in network

1

With getpeerinfo command I can get all directly connected peers ip addresses, how to know mine in the bitcoin network?

Ashot Khachatryan

Posted 2017-09-30T19:04:50.023

Reputation: 111

Answers

2

getnetworkinfo will tell you the IP address of your node if it knows what it actually is (or thinks it knows). It will be in the localaddresses field. Note that it may not contain your IP address or have the right IP addresses as it is difficult to know what your IP address is unless someone external tells you what it is.

Andrew Chow

Posted 2017-09-30T19:04:50.023

Reputation: 40 910

What I am trying to do is to connect to other node with -addnode, or -connect options, but the question is how to know other nodes address. Both nodes are mine.Ashot Khachatryan 2017-09-30T19:34:13.827

2

The node's IP address is the IP address of the machine it is running on. On that machine, you can go to a website like https://www.whatismyip.com/ to find your IP address.

Andrew Chow 2017-09-30T19:38:26.870

So if I have two different bitcoin nodes running in different networks I can use their external ip-s to connect them?Ashot Khachatryan 2017-09-30T19:45:10.237

Yes, you use their external IP addresses. Connecting them works in the same way that other nodes connect to your nodes.Andrew Chow 2017-09-30T19:46:06.277

Strange thing is that after addnode I am checking the status with getaddednodeinfo but 'connected' is always false.Ashot Khachatryan 2017-09-30T19:52:20.883