<p>That's a good question, but nothing really substantial changes.</p>

<p>The node will reconnect to a peer (whose IP address has remained the same) and the node's new IP address is added to the list of available peers. The old IP address remains in the list, but eventually removed when it gets older: the peer list also keeps track of the last time it saw the node.</p>

<blockquote>
  <p>it shares its own ip to all of the peers</p>
</blockquote>

<p>It doesn't actually, the node you connected to will tell you what your IP address is. (I'm not a 100% sure about this tho)</p>

<blockquote>
  <p>what if the list if full of old IPs?</p>
</blockquote>

<p>Well, that's why there are 'seed nodes' active on the network. They often use domain names, which get resolved to IP addresses (so they can change). They only exist to distribute peer lists. In Bitcoin Core, you connect to the seed node and disconnect after about a minute. You should have enough IPs in your peer list to remain connected to the network from then on.</p>

CC BY-SA 3.0
2017-07-06T00:59:34.410Z
2017-07-06T01:06:49.867Z
2017-07-06T01:06:49.867Z
Penquin
<p>From what I understand, when a node first comes online, it requests a list of known IPs from all of it's peers. I'm assuming that by doing that, it shares its own ip to all of the peers, which in turn save it into their list. At this point, the network is in sync.</p>

<p>My question is, what happens when the node in question changes IPs?</p>

CC BY-SA 3.0
2017-07-06T00:20:20.733Z
Well, you can't change IP without disconnecting and re-connecting, which means you would start the sync process all over.
Mr.Nobody
CC BY-SA 3.0
2017-07-06T00:22:47.530Z
What if the node is assigned a new IP? It would not be aware of that
jeanluc
CC BY-SA 3.0
2017-07-06T00:27:17.523Z
Any app that is currently connected when a new IP is assigned loses connection, because connections are based on IP:Port, because the IP no longer exists.  The app would need to reconnect to re-establish a connection with the new IP.
Mr.Nobody
CC BY-SA 3.0
2017-07-06T00:37:21.463Z
You are probably confused because many apps automatically reconnect when this happens, so it appears they keep a stable connection.  But behind the scenes, they don't.
Mr.Nobody
<network><nodes><connection><peer-discovery>
How does the network handle changing IPs?
jeanluc
# How does the network handle changing IPs?

(Asked by: username_0 on 2017-07-06)

From what I understand, when a node first comes online, it requests a list of known IPs from all of it's peers. I'm assuming that by doing that, it shares its own ip to all of the peers, which in turn save it into their list. At this point, the network is in sync.

My question is, what happens when the node in question changes IPs?

**Tags:** network, nodes, connection, peer-discovery

> **Comments:**
> **username_1**: Well, you can't change IP without disconnecting and re-connecting, which means you would start the sync process all over.  
> **username_0**: What if the node is assigned a new IP? It would not be aware of that  
> **username_1**: Any app that is currently connected when a new IP is assigned loses connection, because connections are based on IP:Port, because the IP no longer exists.  The app would need to reconnect to re-establish a connection with the new IP.  
> **username_1**: You are probably confused because many apps automatically reconnect when this happens, so it appears they keep a stable connection.  But behind the scenes, they don't.  

---

## 1 answers

### Answer by username_2 on 2017-07-06. Score: 0 | Accepted answer

That's a good question, but nothing really substantial changes.

The node will reconnect to a peer (whose IP address has remained the same) and the node's new IP address is added to the list of available peers. The old IP address remains in the list, but eventually removed when it gets older: the peer list also keeps track of the last time it saw the node.

> it shares its own ip to all of the peers

It doesn't actually, the node you connected to will tell you what your IP address is. (I'm not a 100% sure about this tho)

> what if the list if full of old IPs?

Well, that's why there are 'seed nodes' active on the network. They often use domain names, which get resolved to IP addresses (so they can change). They only exist to distribute peer lists. In Bitcoin Core, you connect to the seed node and disconnect after about a minute. You should have enough IPs in your peer list to remain connected to the network from then on.


---

