Kubo v0.36.0 → v0.43.1: Private Swarm & Cross-Network Connectivity

I recently upgraded from Kubo v0.36.0 to v0.43.1 and am testing a private swarm using a shared swarm.key.

I noticed that some peers from different IP addresses appear as connected, even though a private swarm is configured. Additionally, cross-network connectivity between nodes on different networks is inconsistent and sometimes fails.

Questions:

  • Is it expected to see peers with different IP addresses in a private swarm?
  • Does a successful connection guarantee that the peer is using the same swarm.key?
  • Have there been any networking changes between v0.36.0 and v0.43.1 that affect relay, hole punching, or peer discovery?
  • What is the recommended configuration for reliable cross-network communication in a private IPFS network?

this was my server config


{

  "Identity": {

    "PeerID": "<PEER_ID>",

    "PrivKey": "<PRIVATE_KEY>"

  },

  "Datastore": {

    "StorageMax": "10GB",

    "StorageGCWatermark": 90,

    "GCPeriod": "1h",

    "Spec": {

      "mounts": [

        {

          "mountpoint": "/blocks",

          "path": "blocks",

          "prefix": "flatfs.datastore",

          "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",

          "sync": false,

          "type": "flatfs"

        },

        {

          "compression": "none",

          "mountpoint": "/",

          "path": "datastore",

          "prefix": "leveldb.datastore",

          "type": "leveldb"

        }

      ],

      "type": "mount"

    },

    "HashOnRead": false,

    "BloomFilterSize": 0,

    "BlockKeyCacheSize": null

  },

  "Addresses": {

    "Swarm": [

      "/ip4/0.0.0.0/tcp/4006",

      "/ip6/::/tcp/4006"

    ],

    "Announce": [],

    "AppendAnnounce": [

      "/ip4/<SERVER_IP>/tcp/4006"

    ],

    "NoAnnounce": [],

    "API": "/ip4/0.0.0.0/tcp/5001",

    "Gateway": "/ip4/0.0.0.0/tcp/8080"

  },

  "Mounts": {

    "IPFS": "/ipfs",

    "IPNS": "/ipns",

    "MFS": "/mfs",

    "FuseAllowOther": false

  },

  "Discovery": {

    "MDNS": {

      "Enabled": true

    }

  },

  "Routing": {

    "Type": "dht",

    "DelegatedRouters": [],

    "AcceleratedDHTClient": false

  },

  "Ipns": {

    "RepublishPeriod": "12h",

    "RecordLifetime": "24h",

    "ResolveCacheSize": 128,

    "UsePubsub": true,

    "DelegatedPublishers": []

  },

  "Bootstrap": [

    "/ip4/<SERVER_IP>/tcp/4006/p2p/<PEER_ID>"

  ],

  "Gateway": {

    "HTTPHeaders": {},

    "RootRedirect": "",

    "NoFetch": false,

    "NoDNSLink": false

  },

  "API": {

    "HTTPHeaders": {}

  },

  "Swarm": {

    "DisableNatPortMap": false,

    "DisableBandwidthMetrics": false,

    "RelayClient": {

      "Enabled": true

    },

    "RelayService": {

      "Enabled": true

    },

    "Transports": {

      "Network": {

        "QUIC": false,

        "WebTransport": false,

        "WebRTCDirect": false,

        "Websocket": false,

        "Relay": true

      }

    },

    "ConnMgr": {

      "Type": "basic",

      "LowWater": 50,

      "HighWater": 200,

      "GracePeriod": "30s"

    },

    "ResourceMgr": {

      "Enabled": false

    },

    "EnableHolePunching": true

  },

  "AutoNAT": {

    "ServiceMode": "disabled",

    "Throttle": {

      "GlobalLimit": 30,

      "PeerLimit": 3,

      "Interval": "1m"

    }

  },

  "AutoTLS": {

    "Enabled": false

  },

  "AutoConf": {

    "Enabled": false

  },

  "Pubsub": {

    "Router": "gossipsub",

    "DisableSigning": false

  },

  "Peering": {

    "Peers": []

  },

  "DNS": {

    "Resolvers": {}

  },

  "Provide": {

    "DHT": {}

  },

  "Experimental": {

    "FilestoreEnabled": false,

    "UrlstoreEnabled": false,

    "Libp2pStreamMounting": false,

    "P2pHttpProxy": false,

    "OptimisticProvide": false,

    "OptimisticProvideJobsPoolSize": 0,

    "IpnsPubsub": true

  },

  "Plugins": {

    "Plugins": null

  },

  "Pinning": {

    "RemoteServices": {}

  }

}

and this was my client config

{

  "Identity": {

    "PeerID": "<PEER_ID>",

    "PrivKey": "<PRIVATE_KEY>"

  },

  "Datastore": {

    "StorageMax": "10GB",

    "StorageGCWatermark": 90,

    "GCPeriod": "1h",

    "Spec": {

      "mounts": [

        {

          "mountpoint": "/blocks",

          "path": "blocks",

          "prefix": "flatfs.datastore",

          "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",

          "sync": false,

          "type": "flatfs"

        },

        {

          "compression": "none",

          "mountpoint": "/",

          "path": "datastore",

          "prefix": "leveldb.datastore",

          "type": "leveldb"

        }

      ],

      "type": "mount"

    },

    "HashOnRead": false,

    "BloomFilterSize": 0,

    "BlockKeyCacheSize": null

  },

  "Addresses": {

    "Swarm": [

      "/ip4/0.0.0.0/tcp/4006",

      "/ip6/::/tcp/4006"

    ],

    "Announce": [],

    "AppendAnnounce": [

      "/ip4/<SERVER_IP>/tcp/4006"

    ],

    "NoAnnounce": [],

    "API": "/ip4/0.0.0.0/tcp/5001",

    "Gateway": "/ip4/0.0.0.0/tcp/8080"

  },

  "Mounts": {

    "IPFS": "/ipfs",

    "IPNS": "/ipns",

    "MFS": "/mfs",

    "FuseAllowOther": false

  },

  "Discovery": {

    "MDNS": {

      "Enabled": true

    }

  },

  "Routing": {

    "Type": "dht",

    "DelegatedRouters": [],

    "AcceleratedDHTClient": false

  },

  "Ipns": {

    "RepublishPeriod": "12h",

    "RecordLifetime": "24h",

    "ResolveCacheSize": 128,

    "UsePubsub": true,

    "DelegatedPublishers": []

  },

  "Bootstrap": [

    "/ip4/<SERVER_IP>/tcp/4006/p2p/<PEER_ID>"

  ],

  "Gateway": {

    "HTTPHeaders": {},

    "RootRedirect": "",

    "NoFetch": false,

    "NoDNSLink": false

  },

  "API": {

    "HTTPHeaders": {}

  },

  "Swarm": {

    "DisableNatPortMap": false,

    "DisableBandwidthMetrics": false,

    "RelayClient": {

      "Enabled": true

    },

    "RelayService": {

      "Enabled": true

    },

    "Transports": {

      "Network": {

        "QUIC": false,

        "WebTransport": false,

        "WebRTCDirect": false,

        "Websocket": false,

        "Relay": true

      }

    },

    "ConnMgr": {

      "Type": "basic",

      "LowWater": 50,

      "HighWater": 200,

      "GracePeriod": "30s"

    },

    "ResourceMgr": {

      "Enabled": false

    },

    "EnableHolePunching": true

  },

  "AutoNAT": {

    "ServiceMode": "disabled",

    "Throttle": {

      "GlobalLimit": 30,

      "PeerLimit": 3,

      "Interval": "1m"

    }

  },

  "AutoTLS": {

    "Enabled": false

  },

  "AutoConf": {

    "Enabled": false

  },

  "Pubsub": {

    "Router": "gossipsub",

    "DisableSigning": false

  },

  "Peering": {

    "Peers": []

  },

  "DNS": {

    "Resolvers": {}

  },

  "Provide": {

    "DHT": {}

  },

  "Experimental": {

    "FilestoreEnabled": false,

    "UrlstoreEnabled": false,

    "Libp2pStreamMounting": false,

    "P2pHttpProxy": false,

    "OptimisticProvide": false,

    "OptimisticProvideJobsPoolSize": 0,

    "IpnsPubsub": true

  },

  "Plugins": {

    "Plugins": null

  },

  "Pinning": {

    "RemoteServices": {}

  }

}

No

Assuming you configured your swarm.key correctly.

Please set LIBP2P_FORCE_PNET=1 . The node should not connect to other random nodes if your swarm key is unique to your 2 nodes. Ensure your swarm.key is where it is expected to be . kubo/docs/experimental-features.md at master · ipfs/kubo · GitHub

Hi @hector ,
We still do not have an answer to the following question for the current Windows-based Kubo configuration:

What is the recommended configuration for reliable cross-network communication in a private IPFS network?

Our integration approach:

We ship Kubo v0.43.1 within our Flutter application as ipfs.dll, rather than as a standalone IPFS installation.

  • We use a Go FFI layer (-buildmode=c-shared) with CGO and MinGW GCC to wrap Kubo functionality.
  • Node lifecycle management is implemented similar to gomobile-ipfs, with access through a local API socket.
  • The embedded Kubo node runs inside the application process.

The default config works for the general scenario. From there there is no one-fits-all guideline. You need to test, read docs/posts, tweak as necessary, and iterate. It may be that between your versions the switch from relay-v1 to v2 happened (unsure), but also many other things that changed configuration template even if backwards compatible.

Hi @hector — thanks. We understand there’s no single template; we’re looking for guidance specific to Kubo 0.43.1 on a private PSK network with cross-NAT clients.

Setup

  • Clients: Kubo 0.43.1 embedded in Flutter (Windows ipfs.dll, mobile gomobile-ipfs), same swarm.key, Swarm.RelayClient with one StaticRelays bootstrap (/ip4/…/tcp/4006/p2p/…).
  • We disable public-network fallbacks (AutoConf, default delegated routers, etc.) and use TCP + PSK.
  • Bootstrap: Kubo [YOUR SERVER VERSION] on [host], [same swarm.key], ports [4006].

Goal
Reliable site mesh across different networks (office LAN, home Wi‑Fi, mobile LTE): pubsub notifications + IPFS cat of site files, not participation in the public IPFS DHT.

Questions

  1. For 0.43.x, is circuit relay v2 the intended path for client↔client via bootstrap, and what minimum bootstrap config do you recommend (Swarm.RelayService, reservations, limits)?
  2. On clients, besides Swarm.RelayClient + StaticRelays, which settings most affect cross-NAT success (hole punching, EnableHolePunching, connmgr, timeouts)?
  3. Any anti-patterns for embedded nodes (no CLI) vs a standard daemon for the same Kubo version?
  4. We sometimes see swarm/connect to bootstrap >12s while peers were already connected — is redundant connect expected to block, or should clients rely on existing relay reservations only?