How to create a private gateway?

How to build a create gateway, only point to our LAN node. What about the steps? Thanks.
likce Ipfs. IO can fetch data from nodes around the world;
A private gateway fetches data from any one of several private nodes.
Like three nodes
/ ip4/192.168.2.7 / TCP / 4001/ ipfs/hash
/ ip4/192.168.2.8 / TCP / 4001 / ipfs/hash
/ ip4/192.168.2.9 / TCP / 4001 / ipfs/hash

Does this help? https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#private-networks

1 Like
patmaddox10h
Does this help? https://github.com/ipfs/go-ipfs/blob/master/docs/experimental-features.md#private-networks2

I did not see the public gateway section that created the private network. I want to access a file with a private web gateway instead of http://ip:8080 /ipfs/hash to access a single node, and if the node fails, you can’t access it, thanks.

If you want the HTTP gateway to listen on a different interface than localhost, you need to change the config after you initialize the IPFS repository and before you run the daemon.

$ ipfs init
initializing IPFS node at /tmp/tmp.osruMYLwM4
generating 2048-bit RSA keypair...done
peer identity: Qmd2A9qtRKHv7tzV2W2B8qPUY3N5jxoiUbC53FmNTwAmk8
to get started, enter:

        ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme

The output from ipfs init shows you where the repository is located. In my case, it’s /tmp/tmp.osruMYLwM4 but will probably be something like /home/myuser/.ipfs for you, unless you change IPFS_PATH.

Then use this directory and open up the config file, which contains which address the gateway will bind to.

$ cat /tmp/tmp.osruMYLwM4/config | jq .Addresses

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

Now, if your private address is 192.168.2.9, just change /ip4/127.0.0.1/tcp/8080 to /ip4/192.168.2.9/tcp/8080 and the gateway will only be available via that IP.

I mean not modify gateway to listen 。
https://ipfs.io/ipfs/hash The hash Can be accessed at any public network node.
I mean to create a type of connection like https://ipfs.io/ipfs/hash ,such as https://private/ipfs/hash just to access the nodes of the private network.
/ip4/192.168.2.9/tcp/8080
/ip4/192.168.2.8/tcp/8080
https://ipfs.io/ipfs/hash What rules are used to access the nodes of the world。
What rules does my private network connection configure access to the private network?

If you create a private network then your files cannot be accessed at any public network node. They will be available only to the members of your private network.

Removing the bootstrap nodes limits your ability to serve files across the network.

You can choose either one:

Share swarm key with all the expected recipietns of the data (They need to run the node though; and make sure they have removed all bootstrap nodes - or your data is evidently accessible by a public gateway as usual)

OR

Use IPFS API to serve data as state to public peers (choose this path only if the audience for your data is so huge and non-tech)