Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/KevinCruz-cell/Redes-de-comunicaciones-/llms.txt

Use this file to discover all available pages before exploring further.

All router connection settings are read from environment variables at runtime. There is no database-backed settings panel — values in your .env file take effect immediately on the next request.

Environment variables

The following variables control how the application connects to your router. None of them are included in .env.example by default; add them manually after copying the file.
ROUTER_IP=192.168.10.1
ROUTER_USER=root
ROUTER_PASSWORD=your_router_password
ROUTER_PORT=22
ROUTER_TIMEOUT=5
VariableDefaultRequiredDescription
ROUTER_IP192.168.10.1YesIP address of the OpenWrt router on your local network
ROUTER_USERrootYesSSH username; OpenWrt’s default administrative account is root
ROUTER_PASSWORD(empty string)YesSSH password configured on the router
ROUTER_PORT22NoSSH port; change only if you have moved SSH to a non-standard port
ROUTER_TIMEOUT5NoSeconds to wait when checking router reachability over HTTP
Store your .env file securely. It contains the router’s root password in plain text. Ensure the file is excluded from version control (it is listed in .gitignore by default).

SSH connection

Configuration and monitoring commands are executed over SSH using phpseclib 3. The SystemRouterService class opens a new SSH2 connection for every request that needs to run a shell command:
$ssh = new SSH2($this->routerIp, $this->sshPort);

if (!$ssh->login($this->sshUser, $this->sshPassword)) {
    throw new Exception('No se pudo conectar por SSH al router.');
}

return $ssh->exec($command);
Each call to SystemRouterService::exec() establishes, uses, and implicitly closes one SSH session. This is a per-request, stateless design — no persistent SSH tunnel is maintained between requests. Commands run on the router include UCI reads and writes, /proc file reads for memory and CPU info, and standard Linux utilities (uptime, date, ip, free). No custom software needs to be installed on the router.
phpseclib is a pure-PHP SSH implementation. It does not depend on the system ssh binary or any PHP extension beyond those already required by Laravel.

HTTP authentication flow

Before any SSH commands can run, the user must authenticate through the login form. The authentication flow uses the router’s LuCI web interface rather than SSH credentials directly:
1

Reachability check

On form submission, RouterService::isReachable() performs an HTTP GET to http://{ROUTER_IP}/cgi-bin/luci/ with a timeout of ROUTER_TIMEOUT seconds. If the request fails or times out, the login is rejected before credentials are ever sent.
2

LuCI credential validation

RouterService::login() posts the username and password as a form to http://{ROUTER_IP}/cgi-bin/luci. A successful login returns an HTTP 302 redirect with a Set-Cookie header containing a sysauth token.
3

Session storage

On success, the following values are written to the PHP session:
session([
    'router_logged_in' => true,
    'router_ip'        => env('ROUTER_IP', '192.168.10.1'),
    'router_user'      => $request->usuario,
    'router_sysauth'   => $login['data']['sysauth'],
    'router_location'  => $login['data']['location'],
]);
The router_logged_in key is the gate checked by route middleware for all protected pages. The router_sysauth cookie value is stored so that subsequent requests can re-validate the LuCI session if needed.
4

Redirect to DHCP page

After the session is established, the user is redirected to /dhcp. All subsequent navigation relies on the presence of router_logged_in in the session.

Logout

Calling POST /logout invokes RouterLoginController::logout(), which removes all five session keys and redirects to /login:
$request->session()->forget([
    'router_logged_in',
    'router_ip',
    'router_user',
    'router_sysauth',
    'router_location',
]);

Network requirements

  • The server running this Laravel application must be on the same local network as the router.
  • The default router address is 192.168.10.1. If your router uses a different address, update ROUTER_IP accordingly.
  • Both SSH (port 22 by default) and HTTP (port 80, for LuCI) must be reachable from the application server.
  • A direct Ethernet connection is more reliable than Wi-Fi for SSH-based management.
If you are running the app on your laptop connected to the router via Wi-Fi, SSH commands will still work, but you may occasionally see timeouts. Use a wired connection for a more stable experience.

Next steps

Dashboard

See what live data the dashboard fetches over SSH after you are authenticated.

API reference

Explore the authentication endpoints exposed by the Laravel application.

Build docs developers (and LLMs) love