---
title: "Reach an environment"
description: "ssh from this Mac, your tailnet from your other devices, and forwarded ports."
---

> Documentation Index
> Fetch the complete documentation index at: https://regent.c4n.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Reach an environment

## ssh

Every environment is in your ssh config as `regent-NAME`, with its own key:

```sh
ssh regent-dev
regent ssh dev -- make test
rsync -az ./app/ regent-dev:~/app/
```

No ssh agent is forwarded. Connecting to a stopped environment starts it first, so tools that
use ssh (editors, Rex, herdr) wake it up.

## Tailnet

```sh
regent create dev --network tailnet
```

The environment joins your [Tailscale](https://tailscale.com) tailnet as its own device,
`regent-NAME`, tagged `tag:regent`, so you can reach it from your other devices. ssh on this
Mac keeps working as the backup.

It needs a tailnet with MagicDNS and HTTPS certificates, and either an OAuth client (one-time
keys per environment, devices deleted on `rm`) or a reusable auth key. `regent tailnet setup`
walks through it; credentials are stored as references, never values. See
[Configuration](https://regent.c4n.dev/docs/reference/configuration/).

`--network ssh` keeps an environment on this Mac only. Set your default with
`regent config set network ssh`.

## Forward a port

```sh
regent forward dev 3000              # http://localhost:3000
regent forward dev 5432:15432        # its 5432 on this Mac's 15432
regent forward dev 8080 --open       # and open it in the browser
```

The forward runs until Ctrl-C. It goes through Rex when it's installed (and shows there),
otherwise over ssh.

Source: https://regent.c4n.dev/docs/guides/network/index.mdx
