# What happens when you start two nodes with the same PeerID

**URL:** <https://discuss.ipfs.tech/t/what-happens-when-you-start-two-nodes-with-the-same-peerid/10175>\
**Category:** Help\
**Created:** [February 9, 2021, 7:27pm UTC](https://discuss.ipfs.tech/t/what-happens-when-you-start-two-nodes-with-the-same-peerid/10175 "2021-02-09T19:27:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacharywhitley](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/zacharywhitley/32/2670_2.png) [@zacharywhitley](https://discuss.ipfs.tech/u/zacharywhitley)\
**Post date:** [February 9, 2021, 7:27pm UTC](https://discuss.ipfs.tech/t/what-happens-when-you-start-two-nodes-with-the-same-peerid/10175/1 "2021-02-09T19:27:32Z")

</div>

I was just pondering things and had a curious thought. What happens when if you were to start two IPFS nodes with the same PeerID?

---

<div class="post-metadata">

**Author:** ![ipfsme](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ipfsme/32/3907_2.png) [@ipfsme](https://discuss.ipfs.tech/u/ipfsme)\
**Post date:** [February 9, 2021, 8:16pm UTC](https://discuss.ipfs.tech/t/what-happens-when-you-start-two-nodes-with-the-same-peerid/10175/2 "2021-02-09T20:16:06Z")

</div>

The only way to get two nodes with the same Peer ID is to purposefully copy the Peer ID…

`ipfs init -c /my/ipfs/directory`

should always generate a new and unique Peer ID.

---

<div class="post-metadata">

**Author:** ![zacharywhitley](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/zacharywhitley/32/2670_2.png) [@zacharywhitley](https://discuss.ipfs.tech/u/zacharywhitley)\
**Post date:** [February 9, 2021, 8:23pm UTC](https://discuss.ipfs.tech/t/what-happens-when-you-start-two-nodes-with-the-same-peerid/10175/3 "2021-02-09T20:23:44Z")

</div>

> [@ipfsme](#):
>
> The only way to get two nodes with the same Peer ID is to purposefully copy the Peer ID…

Right. So what happens when someone does that? (purposefully is probably a poor description because it can be done inadvertently and probably quite easily)

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [February 9, 2021, 10:28pm UTC](https://discuss.ipfs.tech/t/what-happens-when-you-start-two-nodes-with-the-same-peerid/10175/4 "2021-02-09T22:28:19Z")

</div>

Things won’t work as expected. Connections may go to the wrong peer etc.

---

<div class="post-metadata">

**Author:** ![zacharywhitley](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/zacharywhitley/32/2670_2.png) [@zacharywhitley](https://discuss.ipfs.tech/u/zacharywhitley)\
**Post date:** [February 9, 2021, 11:15pm UTC](https://discuss.ipfs.tech/t/what-happens-when-you-start-two-nodes-with-the-same-peerid/10175/5 "2021-02-09T23:15:59Z")

</div>

So the problems would be localized to the two misconfigured nodes. I guess I was concerned about problems to the broader network…now I’m wondering about malicious nodes advertising themselves as relay hosts.

Thanks for the info.

---

<div class="post-metadata">

**Author:** ![ipfsme](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ipfsme/32/3907_2.png) [@ipfsme](https://discuss.ipfs.tech/u/ipfsme)\
**Post date:** [February 10, 2021, 12:55am UTC](https://discuss.ipfs.tech/t/what-happens-when-you-start-two-nodes-with-the-same-peerid/10175/6 "2021-02-10T00:55:34Z")

</div>

> [@zacharywhitley](#):
>
> malicious nodes advertising themselves as relay hosts.

A node will refuse to start if the Peer ID and the Private Key do not match. So, unless one distributes the private key or the private key is stolen, one need not worry about impersonation. Simply knowing the Peer ID is not a security issue.
