Skip to main content
Documentation

Establish a Remote Connection

Use Nexigon CLI to reach a service on a connected device. Forwarding a TCP port lets you use tools such as SSH or a web browser on your workstation. For a browser link that works without a local forwarding process, request an HTTP proxy URL.

Before You Start

You need:

  • Nexigon CLI installed and configured.
  • A connected device and permission to access it remotely.
  • An SSH server or HTTP service running on the device.
  • The device’s own SSH credentials if you want an SSH session.

The commands below run the downloaded binary as ./nexigon-cli. On Windows, use .\nexigon-cli.exe, or run nexigon-cli if it is on your PATH.

Find the Device

List projects and then the devices in your project:

./nexigon-cli projects list
./nexigon-cli projects devices list <project-id>

Use a returned deviceId, beginning with d_, in the commands below. You can also copy the ID from a device’s page in Nexigon.

Permit the Device Ports

Nexigon Agent 0.6 and later requires the destination port to be permitted by the device’s configuration. An HTTP export permits its own port. For additional services, configure an allowlist on the device and restart Nexigon Agent:

/etc/nexigon/agent.toml
[forwarding]
enabled = true
allowed-tcp-ports = [22, 80]

This example permits SSH on port 22 and HTTP on port 80. It grants raw TCP access to those ports. Nexigon Hub’s remote-access permissions also apply. See TCP Forwarding for the full policy.

Connect over SSH

Forward local port 2222 to the device’s SSH port:

./nexigon-cli forward <device-id> 2222:22

Leave that command running. In another terminal, connect to the local port:

ssh -p 2222 root@127.0.0.1

Replace root with the SSH user configured on the device. Authenticate with that user’s SSH key or password. Your Nexigon API token authorizes the tunnel; the SSH server still checks its own credentials.

Press Ctrl+C in the forwarding terminal when you no longer need the tunnel.

Access a Web Server or Several Ports

To forward both SSH and the device’s HTTP port, run:

./nexigon-cli forward <device-id> 2222:22 8080:80

Open http://127.0.0.1:8080 in a browser while the command runs. Each pair is <local-port>:<device-port>; choose unused local ports and adjust the device ports to match its services.

Nexigon CLI binds the local listeners to 127.0.0.1, so these forwarded ports are available on your workstation’s loopback interface.

Issue a Browser URL

To access the device’s HTTP service through Nexigon Hub’s proxy:

./nexigon-cli http-proxy issue-url <device-id> --port 80 --valid-for 600

Open the url field from the JSON response in your browser. --valid-for is measured in seconds; this example requests ten minutes. The URL continues to work without a local Nexigon CLI forwarding process until its token expires.

The URL contains an access token. Anyone with the link can use it during its validity period. Generating it does not change the device’s forwarding policy.

Troubleshooting

SymptomWhat to Check
Authentication or permission failureConfirm the selected Nexigon Hub instance and API token, and the token’s permission to access this device remotely.
Local port is already in useChoose another local port, such as 2223:22, then connect SSH to port 2223.
Tunnel opens but the service cannot be reachedConfirm that the device is connected, the service is listening on its loopback address, and the destination port is permitted.
SSH rejects the loginCheck the device’s SSH username, key, and password.
A browser URL stops workingIssue a new URL if its token has expired, and check that the device and HTTP service are online.