# What is this random open port?

**URL:** <https://discuss.ipfs.tech/t/what-is-this-random-open-port/1469>\
**Category:** Uncategorized\
**Created:** [November 17, 2017, 6:09pm UTC](https://discuss.ipfs.tech/t/what-is-this-random-open-port/1469 "2017-11-17T18:09:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulogr](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/paulogr/32/493_2.png) [@paulogr](https://discuss.ipfs.tech/u/paulogr)\
**Post date:** [November 17, 2017, 6:09pm UTC](https://discuss.ipfs.tech/t/what-is-this-random-open-port/1469/1 "2017-11-17T18:09:37Z")

</div>

Every time I initialize the ipfs daemon I see a random port opened in my swarm addresses using my external ip.

`Swarm announcing /ip4/191.180.124.121/tcp/37710`

What is that for?

Thank you!

---

<div class="post-metadata">

**Author:** ![leerspace](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@leerspace](https://discuss.ipfs.tech/u/leerspace)\
**Post date:** [November 17, 2017, 6:44pm UTC](https://discuss.ipfs.tech/t/what-is-this-random-open-port/1469/2 "2017-11-17T18:44:09Z")

</div>

The default port for making connections should be 4001, so I’m guessing something changed it from the default to 37710.

What does `ipfs config show` give for the “Addresses” section?

```auto
"Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001"
    ]
  },

```

---

<div class="post-metadata">

**Author:** ![paulogr](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/paulogr/32/493_2.png) [@paulogr](https://discuss.ipfs.tech/u/paulogr)\
**Post date:** [November 17, 2017, 6:50pm UTC](https://discuss.ipfs.tech/t/what-is-this-random-open-port/1469/3 "2017-11-17T18:50:20Z")

</div>

My config is bellow:

```auto
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001"
    ]
  },

```

Every time I start the ipfs daemon I get a random port.

Now for example, I had started the daemon again an get port **20298**

`Swarm announcing /ip4/191.180.XXX.XXX/tcp/20298`

---

<div class="post-metadata">

**Author:** ![paulogr](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/paulogr/32/493_2.png) [@paulogr](https://discuss.ipfs.tech/u/paulogr)\
**Post date:** [November 17, 2017, 7:45pm UTC](https://discuss.ipfs.tech/t/what-is-this-random-open-port/1469/4 "2017-11-17T19:45:20Z")

</div>

This is the output when I start the daemon.

```auto
Initializing daemon...
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/192.168.0.7/tcp/4001
Swarm listening on /ip6/2804:14c:138:9124:10a0:ea1c:b4e5:883/tcp/4001
Swarm listening on /ip6/2804:14c:138:9124:9d69:7dbe:a603:8c05/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit/ipfs/QmXKPVNkWsLmTMXQtxtmiUj37vv61nceiGzPPq4tdC351k
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip4/192.168.0.7/tcp/4001
Swarm announcing /ip6/2804:14c:138:9124:10a0:ea1c:b4e5:883/tcp/4001
Swarm announcing /ip6/2804:14c:138:9124:9d69:7dbe:a603:8c05/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

```

Doesn’t even list my external ip address.

---

<div class="post-metadata">

**Author:** ![paulogr](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/paulogr/32/493_2.png) [@paulogr](https://discuss.ipfs.tech/u/paulogr)\
**Post date:** [November 17, 2017, 8:35pm UTC](https://discuss.ipfs.tech/t/what-is-this-random-open-port/1469/5 "2017-11-17T20:35:39Z")

</div>

I think this should be related I’m behind a NAT.

> <https://github.com/ipfs/go-ipfs/issues/57>
>
> Peers behind nats need a way for other peers in the network to connect to them. It would be nice to...

Could someone confirm that?

If I don’t get the port 4001 open for the world anyone can find my node right?

Is that any workaround?

Thank you!

---

<div class="post-metadata">

**Author:** ![leerspace](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@leerspace](https://discuss.ipfs.tech/u/leerspace)\
**Post date:** [November 18, 2017, 12:48am UTC](https://discuss.ipfs.tech/t/what-is-this-random-open-port/1469/6 "2017-11-18T00:48:37Z")

</div>

NAT traversal would make sense. I tried finding some more details on how IPFS uses it and if there are any configuration options, but I wasn’t finding much.

> [@paulogr](#):
>
> If I don’t get the port 4001 open for the world anyone can find my node right?

My understanding is that if you have UPnP enabled you shouldn’t need to manually open any ports. If not, then you’ll probably need to [open 4001 in your firewall](https://discuss.ipfs.tech/t/how-should-i-configure-my-firewall/471).

---

<div class="post-metadata">

**Author:** ![overbool](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/overbool/32/2479_2.png) [@overbool](https://discuss.ipfs.tech/u/overbool)\
**Post date:** [May 13, 2018, 1:42pm UTC](https://discuss.ipfs.tech/t/what-is-this-random-open-port/1469/7 "2018-05-13T13:42:23Z")

</div>

Maybe the 4001 port already in use.

if 4001 already in use, ipfs will select a random port to dial
