# On-prem Gateway reference

Downloads, requirements, commands, proxies, relocating and removing a gateway.

The On-prem Gateway lets a Zato environment in the cloud connect to the systems in your private network. The installation itself is described in [Installing the On-prem Gateway](https://zato.io/docs/admin/on-prem-gateway/install.html).

## Downloads {#downloads}

| Platform | File |
| --- | --- |
| Linux, x86-64 | [zato-on-prem-gateway-linux-amd64](https://github.com/zatosource/zato-on-prem-gateway/releases/latest/download/zato-on-prem-gateway-linux-amd64) |
| Linux, ARM64 | [zato-on-prem-gateway-linux-arm64](https://github.com/zatosource/zato-on-prem-gateway/releases/latest/download/zato-on-prem-gateway-linux-arm64) |

The executable has no dependencies and no configuration file. On Windows, the Linux x86-64 file is used under WSL2.

## Requirements {#requirements}

1. A Linux host running systemd. On Windows, this is a WSL2 distribution with systemd enabled.
2. Outbound HTTPS access from the host to the Zato environment.
3. Root rights on the host, which the service installation requires.

## Commands {#commands}

| Command | Description |
| --- | --- |
| `zato-on-prem-gateway install --token TOKEN` | Connects with the enrollment token, then installs and starts the service |
| `zato-on-prem-gateway` | Connects in the foreground with the enrollment already stored on the host |
| `zato-on-prem-gateway --token TOKEN` | Connects in the foreground with the given enrollment token |
| `zato-on-prem-gateway connect` | Connects in the foreground, the same as with no command |
| `zato-on-prem-gateway status` | Reports the Zato environment, the name of this gateway, its key and where its state is stored |
| `zato-on-prem-gateway install` | Installs the service, which then starts on boot |
| `zato-on-prem-gateway uninstall` | Removes the service |
| `zato-on-prem-gateway start` | Starts the service |
| `zato-on-prem-gateway stop` | Stops the service |
| `zato-on-prem-gateway restart` | Restarts the service |
| `zato-on-prem-gateway version` | Reports the version |

Supplying a token again on a host that is already enrolled as the same gateway keeps the existing enrollment.

## Proxies {#proxies}

The gateway uses the `HTTPS_PROXY` and `NO_PROXY` variables:

```bash
sudo HTTPS_PROXY=http://proxy.corp.local:3128 zato-on-prem-gateway install --token TOKEN
```

When the gateway runs as a service, the variable belongs in a systemd drop-in of the `zato-on-prem-gateway` service, created with `sudo systemctl edit zato-on-prem-gateway`:

```ini
[Service]
Environment=HTTPS_PROXY=http://proxy.corp.local:3128
```

## Relocating a gateway {#relocating-a-gateway}

1. In the Dashboard, click **Reset key** next to the gateway. The gateway is disconnected.
2. Click **Enrollment token** and copy the new token.
3. Install the gateway on the new host with that token.

When **Require key resets** is disabled for the gateway, the first step is omitted, as described in [Re-enrollment](https://zato.io/docs/admin/on-prem-gateway/index.html#re-enrollment).

No outgoing connection in Zato has to be modified.

## Removing a gateway {#removing-a-gateway}

1. On the host, remove the service:

```bash
sudo zato-on-prem-gateway stop
sudo zato-on-prem-gateway uninstall
```

1. In the Dashboard, delete the gateway.
