While HTTP tunneling is the most common use case, Tunels also supports raw TCP tunneling — enabling you to expose databases, SSH servers, game servers, and any other TCP-based service to the internet. Available on Pro plans and above.

When to Use TCP Tunnels

TCP tunneling is useful when you need to expose non-HTTP services:

  • Database access — Let a remote colleague connect to your local PostgreSQL or MySQL instance
  • SSH access — Provide SSH access to a machine behind NAT
  • Game servers — Host a game server from your local machine
  • IoT devices — Expose MQTT brokers or custom protocols
  • Remote debugging — Share a debugging port with a teammate

Creating a TCP Tunnel

The syntax is similar to HTTP tunnels:

tunels tcp 5432

This assigns a random public port on tunnels.tunels.io. The output shows the assigned address:

TCP tunnel established:
  tunnels.tunels.io:12345 → localhost:5432

Example: Sharing a PostgreSQL Database

Your colleague can connect to your local PostgreSQL database using:

psql -h tunnels.tunels.io -p 12345 -U myuser -d mydb

The connection is encrypted through the tunnel. No need to open firewall ports or configure VPNs.

Example: SSH Through a Tunnel

# On your machine (behind NAT):
tunels tcp 22

# Output: tunnels.tunels.io:54321 → localhost:22

# Your colleague connects:
ssh [email protected] -p 54321

Security Best Practices

TCP tunnels expose raw network services, so security is critical:

  • Always use strong authentication on the tunneled service
  • Don't tunnel services without authentication (e.g., Redis without password)
  • Use IP restrictions on Gold/Premium plans to limit who can connect
  • Monitor your tunnel's connection log at localhost:4040
  • Shut down tunnels when you're done

Conclusion

TCP tunneling extends Tunels beyond web development into infrastructure, DevOps, and collaboration scenarios. With a single command, any TCP service on your machine becomes securely accessible from anywhere.