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

# Connect Your First Machine

> Install, log in, host the target, and open your first remote session.

## Four steps to your first connection

```
┌───────────────────────────────────────────────────────────────────┐
│  1. INSTALL   on both machines                                    │
│  2. LOG IN    on both machines   (one Monolex identity)           │
│  3. HOST      on the machine you want to reach                    │
│  4. CONNECT   from the other machine                              │
└───────────────────────────────────────────────────────────────────┘
```

## 1. Install

On **both** machines:

```bash theme={null}
openclis install vpncli
```

## 2. Log in

vpncli uses your Monolex identity — the same login as the rest of the estate.
No ssh keys, no per-machine accounts.

```bash theme={null}
# Interactive (a one-time code by email):
vpncli login

# Automation (CI, AI agents):
vpncli login --api-key vpncli_xxxxxxxxxxxx
```

Do this on **both** machines, signed in as the same identity.

## 3. Host the machine you want to reach

On the **target** machine (the one you want to connect to), make it reachable:

```bash theme={null}
# Persist reachability across restarts:
vpncli service install

# …or host a shell for this session only:
vpncli shell host
```

`service install` keeps the machine online automatically. Now it advertises
itself so your other machines can find it.

## 4. Connect

From your **other** machine:

```bash theme={null}
vpncli ls                    # see all your machines
vpncli ping my-server        # confirm it's reachable
vpncli shell my-server       # open a terminal
```

That's it — you're on the remote machine, over an encrypted peer-to-peer link.

## Check reachability

```
┌───────────────┬───────────────────────────────────────────────────┐
│  STATE        │  MEANING                                          │
├───────────────┼───────────────────────────────────────────────────┤
│  [online]     │ daemon alive, heartbeat fresh — ready to connect  │
│  [stale]      │ heartbeat missing/old — restart the daemon        │
│  [offline]    │ machine down or marked offline                    │
└───────────────┴───────────────────────────────────────────────────┘
```

If a machine shows `[stale]`, on that machine run:

```bash theme={null}
vpncli service status
vpncli daemon logs
```

## Next

<CardGroup cols={2}>
  <Card title="Commands" icon="terminal" href="/vpncli/commands">
    shell, exec, mosh, tunnel — with examples.
  </Card>

  <Card title="Security" icon="lock" href="/vpncli/security">
    What "encrypted end to end" actually means here.
  </Card>
</CardGroup>
