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
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
Now, if your private address is
192.168.2.9, just change
/ip4/192.168.2.9/tcp/8080 and the gateway will only be available via that IP.