IPFS (here, referring to go-ipfs
or kubo
) already supports NAT environments, but there is a lack of documentation explaining this, leading to difficulties in configuration for many users.
Below is an configuration example for supporting NAT environments in IPFS.
{
"Addresses": {
"API": "/ip4/0.0.0.0/tcp/5001",
"Announce": [
"/ip4/[YOUR_PUBLIC_IP]/tcp/4001",
"/ip4/[YOUR_PUBLIC_IP]/udp/4001/quic",
"/ip4/[YOUR_PUBLIC_IP]/udp/4001/quic-v1",
"/ip4/[YOUR_PUBLIC_IP]/udp/4001/quic-v1/webtransport"
],
"AppendAnnounce": [],
"Gateway": "/ip4/0.0.0.0/tcp/8080",
"NoAnnounce": [],
"Swarm": [
"/ip4/0.0.0.0/tcp/4001",
"/ip6/::/tcp/4001",
"/ip4/0.0.0.0/udp/4001/quic",
"/ip4/0.0.0.0/udp/4001/quic-v1",
"/ip4/0.0.0.0/udp/4001/quic-v1/webtransport",
"/ip6/::/udp/4001/quic",
"/ip6/::/udp/4001/quic-v1",
"/ip6/::/udp/4001/quic-v1/webtransport"
]
}
}
Afterwards, you can simply port forward 4001/tcp and 4001/udp on your router or firewall.
Thank you.