> ## Documentation Index
> Fetch the complete documentation index at: https://www.thundercompute.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Port Forwarding

> Set up port forwarding using the CLI. Map remote instance ports to local endpoints for development, testing, and service access on cloud hardware.

export const QuickstartCard = ({ title, icon, href, children, selected }) => {
  const enter = e => { if (selected) return; const el = e.currentTarget; el.style.borderColor = '#555'; el.querySelector('[data-title]').style.color = '#fff'; el.querySelector('[data-sub]').style.opacity = '0.7'; el.querySelector('[data-icon]').style.opacity = '0.7'; };
  const leave = e => { if (selected) return; const el = e.currentTarget; el.style.borderColor = '#333'; el.querySelector('[data-title]').style.color = ''; el.querySelector('[data-sub]').style.opacity = '0.5'; el.querySelector('[data-icon]').style.opacity = '0.35'; };
  return (
  <a href={href} className="group" style={{ textDecoration: 'none', borderBottom: 'none', color: 'inherit', display: 'block', marginBottom: '0.75rem' }}>
    <div className="border rounded-xl p-5 transition-all duration-150 border-zinc-200 dark:border-zinc-800" style={{
      minHeight: '8rem',
      height: '100%',
      borderWidth: '1.5px',
      borderColor: selected ? '#95c5ea' : '#333',
    }} onMouseEnter={enter} onMouseLeave={leave}>
      <div data-icon style={{ marginBottom: '0.75rem', opacity: selected ? 1 : 0.35, transition: 'opacity 0.15s ease' }}>
        <Icon icon={icon} size={24} color="#95c5ea" />
      </div>
      <div data-title style={{ fontWeight: 600, fontSize: '1.05rem', marginBottom: '0.25rem', color: selected ? '#fff' : undefined, transition: 'color 0.15s ease' }}>{title}</div>
      <div data-sub style={{ fontSize: '0.9rem', opacity: selected ? 0.7 : 0.5, transition: 'opacity 0.15s ease' }}>{children}</div>
    </div>
  </a>
  );
};

<Columns cols={3}>
  <QuickstartCard title="VS Code" icon="window" href="/docs/vscode/operations/port-forwarding">
    Editor extension
  </QuickstartCard>

  <QuickstartCard title="CLI" icon="terminal" href="/docs/cli/operations/port-forwarding" selected={true}>
    Command line
  </QuickstartCard>

  <QuickstartCard title="Console" icon="browser" href="/docs/console/operations/port-forwarding">
    Web interface
  </QuickstartCard>
</Columns>

<Note>
  Port forwarding is also available through the [VS Code extension](/docs/vscode/operations/port-forwarding) and the [Console](/docs/console/operations/port-forwarding).
</Note>

## How It Works

When you forward a port, your HTTP service becomes available at:

```
https://<instance-uuid>-<port>.thundercompute.net
```

For example, if your instance UUID is `abc123` and you forward port `8080`, your service is accessible at:

```
https://abc123-8080.thundercompute.net
```

All traffic is automatically secured with HTTPS and protected against DDoS attacks

## Forward Ports

### Interactive Mode

Run the command without arguments to use the interactive interface:

```bash theme={null}
tnr ports forward
```

This guides you through selecting an instance and entering the ports you want to forward.

### Using Flags

Add or remove ports directly with flags:

```bash theme={null}
# Forward a single port
tnr ports forward <instance_id> --add 8080

# Forward multiple ports
tnr ports forward <instance_id> --add 8080,3000,5000

# Remove a forwarded port
tnr ports forward <instance_id> --remove 8080

# Add and remove in one command
tnr ports forward <instance_id> --add 3000 --remove 8080
```

## List Forwarded Ports

See all forwarded ports across your instances:

```bash theme={null}
tnr ports list
```

## Limitations

* **Port 22 is reserved** for SSH and cannot be forwarded
* **Valid port range**: 1-65535
* **HTTP only**: Your service must speak HTTP or gRPC, Other protocols like raw TCP or UDP are not currently supported.

## Example: Exposing a Web Server

1. Start a web server on your instance (e.g., on port 8080)
2. Forward the port:
   ```bash theme={null}
   tnr ports forward <instance_id> --add 8080
   ```
3. Access your service at `https://<instance-uuid>-8080.thundercompute.net`
