---
title: "Deploy public-tunnel"
description: "Make public TCP port use Tailscale and Socat"
category: "Other"
url: https://railway.com/deploy/public-tunnel
---

# Deploy public-tunnel

Make public TCP port use Tailscale and Socat

**[Deploy public-tunnel on Railway](https://railway.com/template/public-tunnel)**

- **Creator:** Nguyen Thuong Hai's Projects
- **Category:** Other
- **Total deploys:** 27

## Template content

### thuonghai2711/publictunnel

- **Image:** thuonghai2711/publictunnel

## Documentation

# Deploy and Host public-tunnel on Railway

public-tunnel is a simple TCP tunneling service that allows you to expose a private TCP service to the public internet without opening inbound ports on the source machine. It works by forwarding traffic through a cloud-hosted tunnel endpoint.

## About Hosting public-tunnel

Hosting public-tunnel on Railway allows you to create a publicly accessible TCP endpoint that forwards traffic to a private target service. Railway provides the public TCP proxy, while public-tunnel handles the connection to the target. This setup is useful for accessing services behind NAT, firewalls, or CGNAT without modifying network infrastructure.

## Common Use Cases

- Exposing Windows RDP (TCP 3389) from a private network
- Providing public access to SSH servers behind NAT
- Forwarding traffic to internal development or testing services

## Dependencies for public-tunnel Hosting

- Docker-compatible runtime
- Tailscale account and auth key

### Deployment Dependencies

- Railway TCP Proxy (free feature)
- Tailscale Auth Keys  
  https://tailscale.com/kb/1085/auth-keys

### Implementation Details 

public-tunnel runs as a Docker container that listens on TCP port 2711 and forwards incoming connections to a target address specified by environment variables.

Required environment variables:

TOKEN=tskey-auth-xxxxxxxx
TARGET=100.x.x.x:PORT


## Why Deploy public-tunnel on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying public-tunnel on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/public-tunnel
