How to setup V1 Relay in the new config

I was manually connecting them. Let me add them in the bootstrap for A & B

ipfs id of A

{
“ID”: “12D3KooWCq8HLWuii9xAwvaKmN7CUvEWfHP8eygwQVc4JQoPTErq”,
“PublicKey”: “CAESICzE8LUriLxkWnIPU+WzZIyyDBLoW5WAstnU6AZ4DruO”,
“Addresses”: [
“/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWCq8HLWuii9xAwvaKmN7CUvEWfHP8eygwQVc4JQoPTErq”
],
“AgentVersion”: “go-ipfs/0.12.2/”,
“ProtocolVersion”: “ipfs/0.1.0”,
“Protocols”: [
“/ipfs/bitswap”,
“/ipfs/bitswap/1.0.0”,
“/ipfs/bitswap/1.1.0”,
“/ipfs/bitswap/1.2.0”,
“/ipfs/id/1.0.0”,
“/ipfs/id/push/1.0.0”,
“/ipfs/lan/kad/1.0.0”,
“/ipfs/ping/1.0.0”,
“/libp2p/autonat/1.0.0”,
“/libp2p/circuit/relay/0.1.0”,
“/libp2p/circuit/relay/0.2.0/stop”,
“/p2p/id/delta/1.0.0”,
“/x/”
]
}

Config of A

{
“API”: {
“HTTPHeaders”: {}
},
“Addresses”: {
“API”: “/ip4/127.0.0.1/tcp/5001”,
“Announce”: ,
“AppendAnnounce”: ,
“Gateway”: “/ip4/127.0.0.1/tcp/8080”,
“NoAnnounce”: ,
“Swarm”: [
“/ip4/127.0.0.1/tcp/4001”,
“/ip4/127.0.0.1/udp/4001/quic”
]
},
“AutoNAT”: {},
“Bootstrap”: [
“/ip4/52.203.215.176/tcp/4001/p2p/12D3KooWQan5Bj7xjK8wuKjLn1CTUKnKX4jufM8bohnhAAKADhAG”,
“/ip4/54.165.44.174/tcp/4001/p2p/12D3KooWAQXE5gfUUWri8EfemPCxMCXnA6Yys8LwMNKqogSPvLgG”
],
“DNS”: {
“Resolvers”: {}
},
“Datastore”: {
“BloomFilterSize”: 0,
“GCPeriod”: “1h”,
“HashOnRead”: false,
“Spec”: {
“child”: {
“path”: “badgerds”,
“syncWrites”: false,
“truncate”: true,
“type”: “badgerds”
},
“prefix”: “badger.datastore”,
“type”: “measure”
},
“StorageGCWatermark”: 90,
“StorageMax”: “10GB”
},
“Discovery”: {
“MDNS”: {
“Enabled”: true,
“Interval”: 10
}
},
“Experimental”: {
“AcceleratedDHTClient”: false,
“FilestoreEnabled”: false,
“GraphsyncEnabled”: false,
“Libp2pStreamMounting”: false,
“P2pHttpProxy”: false,
“StrategicProviding”: false,
“UrlstoreEnabled”: false
},
“Gateway”: {
“APICommands”: ,
“HTTPHeaders”: {
“Access-Control-Allow-Headers”: [
“X-Requested-With”,
“Range”,
“User-Agent”
],
“Access-Control-Allow-Methods”: [
“GET”
],
“Access-Control-Allow-Origin”: [
“*”
]
},
“NoDNSLink”: false,
“NoFetch”: false,
“PathPrefixes”: ,
“PublicGateways”: null,
“RootRedirect”: “”,
“Writable”: false
},
“Identity”: {
“PeerID”: “12D3KooWCq8HLWuii9xAwvaKmN7CUvEWfHP8eygwQVc4JQoPTErq”,
“PrivKey”: “CAESQDIIQOjQeFh40XADC2DuHMJvAdvsY+oHO44pansD2+IbLMTwtSuIvGRacg9T5bNkjLIMEuhblYCy2dToBngOu44=”
},
“Internal”: {},
“Ipns”: {
“RecordLifetime”: “”,
“RepublishPeriod”: “”,
“ResolveCacheSize”: 128
},
“Migration”: {
“DownloadSources”: ,
“Keep”: “”
},
“Mounts”: {
“FuseAllowOther”: false,
“IPFS”: “/ipfs”,
“IPNS”: “/ipns”
},
“Peering”: {
“Peers”: null
},
“Pinning”: {
“RemoteServices”: {}
},
“Plugins”: {
“Plugins”: null
},
“Provider”: {
“Strategy”: “”
},
“Pubsub”: {
“DisableSigning”: false,
“Router”: “”
},
“Reprovider”: {
“Interval”: “12h”,
“Strategy”: “all”
},
“Routing”: {
“Type”: “dht”
},
“Swarm”: {
“AddrFilters”: null,
“ConnMgr”: {
“GracePeriod”: “20s”,
“HighWater”: 900,
“LowWater”: 600,
“Type”: “basic”
},
“DisableBandwidthMetrics”: false,
“DisableNatPortMap”: false,
“EnableHolePunching”: true,
“RelayClient”: {
“Enabled”: true
},
“RelayService”: {},
“Transports”: {
“Multiplexers”: {},
“Network”: {},
“Security”: {}
}
}
}

ipfs daemon output

Initializing daemon…
go-ipfs version: 0.12.2
Repo version: 12
System version: amd64/windows
Golang version: go1.16.15
Swarm is limited to private network of peers with the swarm key
Swarm key fingerprint: c99475fbaea06dea11eb63c9e19f8b9e
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/127.0.0.1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

On A, use ipfs swarm peers to confirm it is indeed connected to C & D. Then use ipfs id <id> on A for C & D, and see if you get the right responses. Then use ipfs dht findpeer <id> to confirm that works too. If all that works properly, we’ll check other things (but, to be honest, I don’t see anything wrong anymore, so I’m not sure what to explore next yet).

It works properly, but cannot see B from A. I can give you all of my test acc (ubuntu server for you to trace if you want). It is serious to my project, hope we can find the root cause

If we can’t solve it by the time I get off work, I may ask you for that so that I can poke around and try to figure out what is going on. In his ipfs daemon output, it actually states that it’s listening on /p2p-circuit, but then it doesn’t announce it. I can’t explain why it doesn’t

1 Like

FYI: some commands

Things look fine as you mentioned. But it doesn’t publish relay address on A

Yeah, that’s normal. The node you are trying to reach must first connect to the relay server itself, then announce it (that’s what’s known as the reservation). Then, using the address it announced, you can connect to it. Just trying a random relay won’t work, because the target doesn’t have a connection to it, and it’s just as stuck as you are, it can’t dial the node any more than you can.

1 Like

Looks good. That part is now working the way it should.

In your ipfs daemon output, it says it’s listening on /p2p-circuit, but then only announces the localhost address instead of announcing both. That’s where the next problem is, but I’m not sure what could be causing that.

I’m trying a few things on my own nodes right now, to see if I can get some insights into what is going on.

2 Likes

Sure. Thank you for the help.
Let me know if you want swarm.key of my private network to look at the issue more deeper.

OK, I have it working flawlessly on one of my nodes (it can be done :grin:). However, I’m using the main net, not a private net like you guys are trying to do (I’m not sure it matters, but I had to disclose it).

I’m using the same configuration you are using:

"Addresses": {
	"API": "/ip4/127.0.0.1/tcp/5001",
	"Announce": [],
	"AppendAnnounce": null,
	"Gateway": "/ip4/127.0.0.1/tcp/8080",
	"NoAnnounce": [],
	"Swarm": [
		"/ip4/127.0.0.1/tcp/4001",
		"/ip4/127.0.0.1/udp/4001/quic"
	]
},
...
	"EnableHolePunching": true,
	"RelayClient": {
		"Enabled": true
	},
	"RelayService": {},

However, the thing is kinda fickle. There are two things I noticed:

  • if the node thinks it has the ability to be reachable (even if you prevent it with NoAnnounce), it will not connect to the relay service, ever.
  • it doesn’t connect to the relay service right away. when the node finishes coming up, it only announces the localhost address. later, it will start announcing the relay address as well. how much later varies, a lot (it can be as short as 15 seconds, and it has taken as long as 5-10 minutes). I have no idea why.

Once the relay address is announced, I can connect to it with ipfs id <node_id>, which it will answer through the relay, and if I ask for content that only it has, the hole punch connection gets established, and the content is retrieved.

Here is what ipfs id looks like on the node right now:

"Addresses": [
	"/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV",
	"/ip4/127.0.0.1/udp/4001/quic/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV",
	"/ip4/173.255.205.80/tcp/4001/p2p/12D3KooWSc12Ch2SR63TN4KsfwdVpXHBNfTRN6iWqXoUkoqJySM6/p2p-circuit/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV",
	"/ip4/173.255.205.80/udp/4001/quic/p2p/12D3KooWSc12Ch2SR63TN4KsfwdVpXHBNfTRN6iWqXoUkoqJySM6/p2p-circuit/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV",
	"/ip4/79.133.120.84/tcp/4001/p2p/12D3KooWFWLio1PuPnknfXbnZWFCeoK24cEDUsrfuRYHXFrzrT7b/p2p-circuit/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV",
	"/ip4/79.133.120.84/udp/4001/quic/p2p/12D3KooWFWLio1PuPnknfXbnZWFCeoK24cEDUsrfuRYHXFrzrT7b/p2p-circuit/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV",
	"/ip4/80.240.115.153/tcp/4001/p2p/12D3KooWFWLio1PuPnknfXbnZWFCeoK24cEDUsrfuRYHXFrzrT7b/p2p-circuit/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV",
	"/ip4/80.240.115.153/udp/4001/quic/p2p/12D3KooWFWLio1PuPnknfXbnZWFCeoK24cEDUsrfuRYHXFrzrT7b/p2p-circuit/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV",
	"/ip6/2600:3c00::f03c:93ff:fe24:4b86/tcp/4001/p2p/12D3KooWSc12Ch2SR63TN4KsfwdVpXHBNfTRN6iWqXoUkoqJySM6/p2p-circuit/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV",
	"/ip6/2600:3c00::f03c:93ff:fe24:4b86/udp/4001/quic/p2p/12D3KooWSc12Ch2SR63TN4KsfwdVpXHBNfTRN6iWqXoUkoqJySM6/p2p-circuit/p2p/12D3KooWKuSzGoorvsBB8zdXCYVMEfybYKa7sDgXT3AkofAzX3FV"
],

It seems to pick the relays at random. If I restart the node, it will pick different ones.

So, let it sit for a bit, see if the relay address comes up. If not, we’ll have to figure out what is different in your setup.

You are right! I deleted swarm.key on 4 PCs and it works. I also noticed the address is different in 2 cases (Of course we need to setup private not public network. This feature should be supported by ipfs I believe)

With swarm.key

{
“ID”: “12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“PublicKey”: “CAESIFcKxwCuR68/4H5p8ZqiXxzDMoUNcZPb266vJ/EAXIFl”,
“Addresses”: [
“/ip4/10.0.10.10/tcp/4001/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“/ip6/::1/tcp/4001/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”
],
“AgentVersion”: “go-ipfs/0.12.1/”,
“ProtocolVersion”: “ipfs/0.1.0”,
“Protocols”: [
“/ipfs/bitswap”,
“/ipfs/bitswap/1.0.0”,
“/ipfs/bitswap/1.1.0”,
“/ipfs/bitswap/1.2.0”,
“/ipfs/id/1.0.0”,
“/ipfs/id/push/1.0.0”,
“/ipfs/lan/kad/1.0.0”,
“/ipfs/ping/1.0.0”,
“/libp2p/autonat/1.0.0”,
“/libp2p/circuit/relay/0.1.0”,
“/libp2p/circuit/relay/0.2.0/stop”,
“/p2p/id/delta/1.0.0”,
“/x/”
]
}

Without swarm.key

{
“ID”: “12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“PublicKey”: “CAESIFcKxwCuR68/4H5p8ZqiXxzDMoUNcZPb266vJ/EAXIFl”,
“Addresses”: [
“/ip4/10.0.10.10/tcp/4001/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“/ip4/10.0.10.10/udp/4001/quic/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“/ip4/127.0.0.1/udp/4001/quic/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“/ip4/147.75.70.221/tcp/4001/p2p/Qme8g49gm3q4Acp7xWBKg3nAa9fxZ1YmyDJdyGgoG6LsXh/p2p-circuit/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“/ip4/147.75.70.221/udp/4001/quic/p2p/Qme8g49gm3q4Acp7xWBKg3nAa9fxZ1YmyDJdyGgoG6LsXh/p2p-circuit/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“/ip6/::1/tcp/4001/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”,
“/ip6/::1/udp/4001/quic/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS”
],
“AgentVersion”: “go-ipfs/0.12.1/”,
“ProtocolVersion”: “ipfs/0.1.0”,
“Protocols”: [
“/ipfs/bitswap”,
“/ipfs/bitswap/1.0.0”,
“/ipfs/bitswap/1.1.0”,
“/ipfs/bitswap/1.2.0”,
“/ipfs/id/1.0.0”,
“/ipfs/id/push/1.0.0”,
“/ipfs/lan/kad/1.0.0”,
“/ipfs/ping/1.0.0”,
“/libp2p/autonat/1.0.0”,
“/libp2p/circuit/relay/0.1.0”,
“/libp2p/circuit/relay/0.2.0/stop”,
“/p2p/id/delta/1.0.0”,
“/x/”
]
}

Hmmm, so the issue is that relay v2 doesn’t support the use of swarm keys. Well, that kinda sucks, it means that your only recourse is to set up proper port forwarding on all your client nodes instead then… :confused:

1 Like

I have 2 questions:

  1. I have not set up 147.75.195.153, 147.75.70.221. I guess it is hard coded in IPFS when no swarm.key, correct?
    ipfs swarm peers
    /ip4/147.75.195.153/tcp/4001/p2p/QmW9m57aiBDHAkKj9nmFSEn7ZqrcF1fZS4bipsTCHburei
    /ip4/147.75.70.221/tcp/4001/p2p/Qme8g49gm3q4Acp7xWBKg3nAa9fxZ1YmyDJdyGgoG6LsXh
    /ip4/147.75.70.221/tcp/4001/p2p/Qme8g49gm3q4Acp7xWBKg3nAa9fxZ1YmyDJdyGgoG6LsXh/p2p-circuit/p2p/12D3KooWFg9ApLqQiTdkaGhgFNTWFsiRMCSDGCQgZ1RuBwSMXAmS
    /ip4/52.221.249.235/tcp/4001/p2p/12D3KooWLjHvyiufBnv3whtWnJ1ZrZjkX4jmohbioQi1dym8LTab
    /ip4/54.169.103.175/tcp/4001/p2p/12D3KooWR9zzY5ZZnKyvwm5cKTxexPFQ4DZCypAtqZ1sHDm2GtqP
  2. Do you have any documents relating to port forwarding setup
  3. Does relay v1 work with swarm.key (It seems susarlanikhilesh made it worked)
  1. no, it discovered those addresses in the dht (nodes on your network announced those addresses to the dht). actually, it looks like you connected to main net, which means you are using main net bootstrap addresses, not your own nodes. fix that.
  2. unfortunately, port forwarding is set up on your router (not ipfs, not your computer), and there’s a gazillion different routers on the market, so refer to your router’s manual. you need to forward tcp 4001 and udp 4001 to your computer’s private IP address.
  3. I assume it did, but I have no experience with it. v1 is still available as a stand alone daemon, you could run that on your C node instead of the ipfs daemon, and it should work (your client nodes will pick up either v1 or v2, they don’t care, they support both).

Should we raise an issue on go-ipfs project ?

The standalone daemon also does not support I believe.
If you referring to this.

Yeah, I’d let them know it’s something you care about. If enough people want it, I’m sure they’ll prioritize it.

1 Like

Using the relay-daemon and making it private we were able to connect and my client node is publishing the relay address as part of address. But they are dropping and those values to show up in the addresses take time. Where does this lie to check and to keep it alive as long as the ipfs is running.

what can be sometimes, that it advertises as a hop but does not publish the public address

{
        "ID": "12D3KooWNE76XyRBtKYhmVbnTryyAEE8wsFLocKHDrg9CG27sUau",
        "PublicKey": "CAESILhhI9FlJ1HlemKDgsW58+4umRZMaFhDG9pOrR197/2K",
        "Addresses": [
                "/ip4/127.0.0.1/tcp/4001/p2p/12D3KooWNE76XyRBtKYhmVbnTryyAEE8wsFLocKHDrg9CG27sUau",
                "/ip4/172.28.1.135/tcp/4001/p2p/12D3KooWNE76XyRBtKYhmVbnTryyAEE8wsFLocKHDrg9CG27sUau",
                "/ip6/::1/tcp/4001/p2p/12D3KooWNE76XyRBtKYhmVbnTryyAEE8wsFLocKHDrg9CG27sUau"
        ],
        "AgentVersion": "go-ipfs/0.14.0-dev/ce7d41cc",
        "ProtocolVersion": "ipfs/0.1.0",
        "Protocols": [
                "/ipfs/bitswap",
                "/ipfs/bitswap/1.0.0",
                "/ipfs/bitswap/1.1.0",
                "/ipfs/bitswap/1.2.0",
                "/ipfs/id/1.0.0",
                "/ipfs/id/push/1.0.0",
                "/ipfs/lan/kad/1.0.0",
                "/ipfs/ping/1.0.0",
                "/libp2p/autonat/1.0.0",
                "/libp2p/circuit/relay/0.1.0",
                "/libp2p/circuit/relay/0.2.0/hop",
                "/libp2p/circuit/relay/0.2.0/stop",
                "/p2p/id/delta/1.0.0",
                "/x/"
        ]
}