How to connect a peer with an external IP address

Yup, the key component is the private key inside the config file. It looks like this:

  "Identity": {
    "PeerID": "12D3KooW...",
    "PrivKey": "CAESQ..."
1 Like

How can I make a domain name instead of an IP for a personal node that will be in bootstrap?

That’s a bit more complicated, you’ll need to register that domain name with a registrar, and then set up several DNS records behind it. I once read a document on how to set up a “/dnsaddr/” address, and it’s a bit convoluted. I’d have to locate that document.

Setting up a domain for a CID is a lot easier, I have a few of those.

P.S. Found it!

The fact is that it is more reliable to use a domain name in the bootstrap, since the IP is much more difficult to restore

Thank you ylempereur

Do you mean centralized?

Yes, an actual DNS domain and DNS records.

I know that some people also use web3 type domains for CIDs, but I don’t really know much about it. You’ll have to research that yourself if that’s what you want to do.

1 Like

Hey ylempereur.
Is it necessary to set port mapping for the relay node to work?

Absolutely yes!

Something somewhere has to be reachable for a connection to be established. If absolutely nothing is reachable, no connection of any kind can be established. So, if all your nodes aren’t reachable, then the only thing that will allow them to establish a connection is a relay node that is reachable.

So, at a very minimum, all bootstrap nodes and all relay nodes must be reachable. Which means, they’re either not behind NAT or they have port mapping set up.

1 Like

Could you tell me how to use relay libp2p? Otherwise, the relay ID is not displayed in the console…

I’m not exactly sure what it is you are asking. If you are using Kubo, it should all be automatic.

Your node first uses AutoNAT to detect if it is reachable. If it is not, it finds and registers with a relay node on the network. It then publishes its relayed address to the DHT.

When another node wants to connect, it looks up the address in the DHT, and connects to it (it connects to the relay). For small amounts of data, it then simply communicates using that connection. If blocks need to be exchanged, it negotiates and attempts a hole punching (direct) connection. If successful, it uses that connection from then on. If not successful, there is no other recourse, and the blocks cannot be exchanged.

1 Like

Hey ylempereur

Is it possible to generate only 4001 (or other specific) port in Kubo, like in the Torrent using UPnP?

That’s what I do. Here is the config for one of my nodes that does exactly that:

  "Addresses": {
    "AppendAnnounce": [
    "Swarm": [

Note that the port is 4001 everywhere.

UPnP still generates a different port randomly

I know that for ipv6 the default port is 4001, but in cases with ipv4 UPnP generates a random port

Oh, you can’t use UPnP, that’s always random, you have to create a port mapping

Why can the uTorrent set a port for UPnP?

My guess is, Kubo doesn’t attempt to set a specific port, it just requests a random one from UPnP.

Maybe one of the devs can chime in, go isn’t one of my languages, and I wouldn’t know where to look in the source (it’s fairly large).

1 Like