Skip to content

Telnet connection

Danik edited this page Jun 16, 2026 · 2 revisions

Telnet Connection

🆕 New in tik4net 4.x (alpha preview). This transport ships in the upcoming 4.x line, which is not yet publicly released; its API and behaviour may change before 4.0. Only the binary Api / ApiSsl transports are considered stable — see Connection types & capabilities.

Telnet (TikConnectionType.Telnet) connects to a MikroTik router over plain-text TCP port 23 and drives the RouterOS CLI through an interactive terminal session. It gives you full CRUD when the binary API and SSH are unavailable, e.g. on locked-down or legacy setups where only Telnet is enabled.

It uses the same CLI layer as the SSH and MAC-Telnet transports (print as-value parsing, paging prevention, VT100 handling), so all CRUD operations behave identically.

⚠️ Telnet is unencrypted. Credentials and all traffic travel in clear text. Prefer SSH, WinBox CLI or the SSL API on any network you do not fully trust. Telnet is also disabled by default on modern RouterOS.

Router prerequisites

Enable the Telnet service on the router (disabled by default on recent RouterOS):

/ip/service set telnet disabled=no

Basic usage

using tik4net;

using (var conn = ConnectionFactory.OpenConnection(
    TikConnectionType.Telnet, "192.168.4.1", "admin", ""))
{
    var ifaces = conn.LoadAll<tik4net.Objects.Interface.Interface>().ToList();
    Console.WriteLine($"Found {ifaces.Count} interfaces");
}

Using TikConnectionSetup

var setup = new TikConnectionSetup("192.168.4.1", "admin", "");

using (var conn = setup.CreateTelnetConnection())
{
    var identity = conn.CreateCommand("/system/identity/print").ExecuteScalar();
    Console.WriteLine(identity);
}

Capability

CRUD, Listen and Safe Mode — Telnet reports Crud | Listen | SafeMode, like the other CLI transports. A terminal has no server push, so the callback-based async APIs (LoadAsync, LoadListenAsync, ExecuteAsync) are emulated by polling a one-shot snapshot on a background worker (see the MAC-Telnet page for the per-call-shape breakdown — the behaviour is identical).

bool hasCrud     = conn.Supports(TikConnectionCapability.Crud);     // true
bool hasListen   = conn.Supports(TikConnectionCapability.Listen);   // true
bool hasSafeMode = conn.Supports(TikConnectionCapability.SafeMode); // true

TikConnectionCapability.Streaming (ExecuteListWithDuration) is not reported — use the API transport for that. Interactive-only commands (notably /tool/torch) surface a guiding error through the async error callback.

See also

Clone this wiki locally