1 running multiple tunnels
Sam Bent edited this page 2026-07-17 15:15:52 -04:00

Running multiple tunnels

The simple setup gives one service one address. You can run more than one, and you have two choices about how the addresses relate to each other.

Several services, several addresses

Most of the time you want each service to have its own separate address. Give each one a name and its own line. The pattern is:

<NAME>_I2P_SERVICE_HOSTS = "i2p_port:backend_host:backend_port"

For example, a website and an SSH box, each with its own address:

environment:
  SITE_I2P_SERVICE_HOSTS: "80:web:80"
  SSH_I2P_SERVICE_HOSTS: "22:sshd:22"

Each name produces its own .b32.i2p address, saved as site.b32.i2p and ssh.b32.i2p in the keys folder. They are independent identities with independent keys. Back up the whole folder as usual.

From the command line, the setup tool builds this for you:

./scripts/i2pforge setup --services site:80:web:80,ssh:22:sshd:22

One address, several ports

Sometimes you want a single service reachable on more than one port under the same address. For example, a web server on both port 80 and port 443. To do that, put several mappings under one name, separated by commas:

environment:
  SITE_I2P_SERVICE_HOSTS: "80:web:80,443:web:443"

Because the mappings share a name, they share one key and therefore one address. Visitors reach the same identity whether they use port 80 or 443.

Which one to choose

  • Use separate names when the services are genuinely different things that should not be linked to each other. Separate keys mean nobody can tell the two addresses belong to the same operator.
  • Use one name with several ports when it really is one service that happens to listen on more than one port, and you want a single address for it.

Naming rules

Service names become part of a filename and a configuration section, so they are kept simple: lowercase letters, digits, and hyphens. The setup tools reject anything else before it reaches the container, so a bad name fails early with a clear message rather than producing a broken tunnel.

The desktop installer

The installer handles a single service. For multiple services, use the command-line setup shown above, which is built for it.