tik4net.testing
4.0.0-alpha2
See the version list below for details.
dotnet add package tik4net.testing --version 4.0.0-alpha2
NuGet\Install-Package tik4net.testing -Version 4.0.0-alpha2
<PackageReference Include="tik4net.testing" Version="4.0.0-alpha2" />
<PackageVersion Include="tik4net.testing" Version="4.0.0-alpha2" />
<PackageReference Include="tik4net.testing" />
paket add tik4net.testing --version 4.0.0-alpha2
#r "nuget: tik4net.testing, 4.0.0-alpha2"
#:package tik4net.testing@4.0.0-alpha2
#addin nuget:?package=tik4net.testing&version=4.0.0-alpha2&prerelease
#tool nuget:?package=tik4net.testing&version=4.0.0-alpha2&prerelease
tik4net
tik4net is a .NET netstandard2.0 library for communicating with MikroTik routers โ enabling use in .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5/6/7/8/9, Xamarin, and Unity. It offers a clean, easy-to-use interface that scales from low-level raw API access all the way up to a fully typed O/R mapper. Tested and debugged against RouterOS 7.21.4 (latest stable).
๐ Many new connection types! Beyond the classic API, tik4net now drives the router over REST, Telnet, SSH, MAC-Telnet, and WinBox (terminal + native-M2, over IP or MAC layer). See Connection types and capabilities. tik4net is the only .NET library that speaks MAC-Telnet and the WinBox protocols.
| Package | NuGet | Description |
|---|---|---|
| tik4net | Everything you normally need: the low-level ADO.NET-like API (sync and async R/W access) and the high-level O/R mapper (strongly typed entities, full CRUD) | |
| tik4net.testing | Unit-testing support โ TikFakeConnection lets you write tests without a live router |
|
| tik4net.ssh | SSH (TCP 22) transport โ drives the RouterOS CLI over an SSH shell (full CRUD, Listen, Safe Mode). A separate package because of its Renci.SshNet dependency. |
โ ๏ธ Upgrading from 3.x? The O/R mapper used to be a separate
tik4net.objectspackage. Since 4.0 it is part oftik4netitself โ remove anyPackageReferencetotik4net.objectsor you will get an assembly conflict. Your source code does not change. See Upgrading from 3.x to 4.0.
Tools โ semi-automatic C# code generators for custom entities. The repo also ships an MCP server exposing a mikrotik_call tool that lets an AI assistant run a command against a live router over any tik4net transport.
Features
- Easy to use with O/R mapper like highlevel API
- Low level access supported by low level API
- Stable interface and backward compatibility
- Broad range of .NET runtimes supported (including .NET core 2 and Xamarin)
- New mikrotik v.6.43 login process supported
- Includes MNDP discovery helper
- ๐ 4.0 Safe Mode โ
SafeModeTake()/SafeModeRelease()/SafeModeUnroll()with automatic rollback-on-disconnect (lockout protection) - ๐ 4.0 Change tracking โ
Savesends only the fields you changed; no-op saves skip the API call - ๐ 4.0 Connection capability model โ
connection.Supports(TikConnectionCapability.Listen); unsupported features fail closed - Unit testing without a router via
tik4net.testing(TikFakeConnection) - Uniform exception tree across all transports
- Easy to understand and well documented code
Connection types
All transports share the same ITikConnection API and O/R mapper โ pick one via TikConnectionType. See Connection types and capabilities.
- Api โ native MikroTik API protocol (TCP 8728); the default, fastest transport with full Listen/Streaming support.
- ApiSsl โ the API protocol over TLS (TCP 8729), using a certificate on the router.
- Rest / RestSsl โ REST API over HTTP (80) / HTTPS (443); requires RouterOS 7.1+.
- Ssh โ drives the RouterOS CLI over an SSH shell (TCP 22); full CRUD plus Listen and Safe Mode.
- Telnet โ drives the RouterOS CLI over plain-text Telnet (TCP 23); full CRUD.
- MacTelnet โ drives the CLI over MAC-Telnet (UDP 20561), reaching the router with no IP route.
- WinboxCli / WinboxCliMac โ drives the CLI over the encrypted WinBox channel (TCP 8291 / MAC layer).
- WinboxNative / WinboxNativeMac โ structured WinBox M2 CRUD with no terminal (TCP 8291 / MAC layer).
Binaries
Install via NuGet โ see the package table above, or:
dotnet add package tik4net # low-level API + O/R mapper โ start here
dotnet add package tik4net.testing # unit-testing support
dotnet add package tik4net.ssh # SSH (TCP 22) transport
See release notes / version history for what's new.
Getting started and documentation
Mikrotik API wiki:
Project wiki:
- Getting started โ step-by-step first project (NuGet โ connect โ CRUD)
- wiki root
- CRUD examples for all APIs
- how to use
- Connection types and capabilities โ pick a transport and see what it supports
- Exception handling โ the full exception tree
- Safe Mode ยท Change tracking โ the flagship 4.0 features
- Communication debugging & testing โ protocol tracing and unit tests without a router
- History
Examples:
- example project
- support forum
- For VisualBasic trivial example see VB example
using (ITikConnection connection = ConnectionFactory.CreateConnection(TikConnectionType.Api)) // TikConnectionType.Api works for both old and new (v6.43+) login
{
connection.Open(HOST, USER, PASS);
ITikCommand cmd = connection.CreateCommand("/system/identity/print");
var identity = cmd.ExecuteScalar();
Console.WriteLine("Identity: {0}", identity);
var logs = connection.LoadList<Log>();
foreach (Log log in logs)
{
Console.WriteLine("{0}[{1}]: {2}", log.Time, log.Topics, log.Message);
}
var firewallFilter = new FirewallFilter()
{
Chain = FirewallFilter.ChainType.Forward,
Action = FirewallFilter.ActionType.Accept,
};
connection.Save(firewallFilter);
ITikCommand torchCmd = connection.CreateCommand("/tool/torch",
connection.CreateParameter("interface", "ether1"),
connection.CreateParameter("port", "any"),
connection.CreateParameter("src-address", "0.0.0.0/0"),
connection.CreateParameter("dst-address", "0.0.0.0/0"));
torchCmd.ExecuteAsync(response =>
{
Console.WriteLine("Row: " + response.GetResponseField("tx"));
});
Console.WriteLine("Press ENTER");
Console.ReadLine();
torchCmd.Cancel();
Looking for help
- I am looking for collaborators. If you are interested in helping maintain this project, please reach out โ open an issue or contact me directly.
- Looking for betatesters
Roadmap & future
See the 4.x roadmap wiki page for details. Highlights:
- create highlevel classes for all mikrotik entities (you can still generate your own classes)
- create tiklink project - easy use-to wrapper over mikrotik router with fluent API
- convert examples to separate unittests (in progress)
- tiktop โ a MikroTik traffic monitor inspired by Linux
iftop(currently in alpha, available on NuGet/GitHub)
Licenses
- Apache 2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- tik4net (>= 4.0.0-alpha2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0 | 35 | 9/16/2026 |
| 4.0.0-beta4 | 42 | 9/16/2026 |
| 4.0.0-beta3 | 58 | 9/15/2026 |
| 4.0.0-beta2 | 91 | 9/6/2026 |
| 4.0.0-beta | 97 | 9/3/2026 |
| 4.0.0-alpha6 | 103 | 8/30/2026 |
| 4.0.0-alpha5 | 103 | 8/25/2026 |
| 4.0.0-alpha4 | 105 | 8/19/2026 |
| 4.0.0-alpha3 | 103 | 8/18/2026 |
| 4.0.0-alpha2 | 97 | 7/20/2026 |
| 4.0.0-alpha | 118 | 6/16/2026 |
| 3.6.0 | 129 | 5/21/2026 |