-
Notifications
You must be signed in to change notification settings - Fork 98
Telnet connection
🆕 New in tik4net 4.0 — first released as
v4.0.0-alpha. Alpha: API and behaviour are stable for testing but may still change before the final 4.0 release. 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.
Enable the Telnet service on the router (disabled by default on recent RouterOS):
/ip/service set telnet disabled=no
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");
}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);
}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); // trueTikConnectionCapability.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.
- SSH-connection — encrypted CLI over an SSH shell (TCP 22)
- MAC-Telnet-connection — Layer-2 CLI (no IP route needed)
- WinBox-CLI-connection — encrypted CLI over the WinBox channel
- Connection types & capabilities — full capability matrix
- Roadmap-4x — transport roadmap