Skip to content
CLI tools

iec101ctl

Interrogate, monitor and command IEC 101 stations on a serial port or behind a terminal server, unbalanced or balanced, with any field sizes; measure the line delay, scan a line for stations, or simulate an RTU. Part of iec60870ctl.

Install

Linux and macOS

curl -fsSL https://get.otfabric.io/iec101ctl | sh

Windows (PowerShell)

irm https://get.otfabric.io/iec101ctl.ps1 | iex

CI, containers and device images

curl -fsSL https://get.otfabric.io/iec101ctl | env OTF_UNMANAGED_INSTALL=/usr/local/bin sh

One static binary for Linux (x86-64, ARM64, ARMv7), macOS (Intel, Apple silicon) and Windows (x86-64, ARM64), with no runtime to install. The installer checks the release's SHA-256 checksum, installs per user without sudo, and upgrades in place when you run it again. Pin a release withOTF_VERSION. All install options. To build from source: go install github.com/otfabric/iec60870ctl/cmd/iec101ctl@latest.

First commands

# No station at hand: start the built-in demo station on port 2401
iec101ctl server start

# What does this station hold? General interrogation over a terminal server
iec101ctl client interrogate --url tcp://127.0.0.1:2401

# The same on a serial port, 9600 8E1
iec101ctl client interrogate --url serial:///dev/ttyUSB0 --link-address 3 --ca 3

# Watch events and measured values as they arrive
iec101ctl client monitor --url tcp://127.0.0.1:2401 --interrogate

# Operate a disconnector with select-before-operate
iec101ctl client command --url tcp://127.0.0.1:2401 --type double --ioa 5001 --value off --mode sbo

# Which stations answer on this multidrop line?
iec101ctl client scan --url serial:///dev/ttyUSB0 --method link --start 1 --end 30

The iec101ctl guide walks through every command group, connection option and safety rule.

For scripts, CI and containers

iec101ctl is as easy to read for a pipeline as for a person. It follows the same conventions as every OT Fabric tool, so a script written for one protocol carries over to the next.

The exit-code table
CodeMeaning
0Success
1Findings: the command completed and its result reports problems, such as a file that does not validate or a diagnosis with a failing check
2Usage: unknown command or flag, a missing argument
3Invalid input: a flag value, a file or a combination that does not make sense. Nothing was sent
4Transport: the connection could not be made, or was lost
5Timeout: the device did not answer in time
6Protocol: the device refused the request, or broke the protocol
7Partial success: a valid result was written, and it holds failures
8Unsupported: the device, or this platform, does not support what was asked
9Permission: the device or the operating system refused, such as raw-socket access without the capability
10Output or internal error
130Interrupted by Ctrl-C or SIGTERM before a result

Each tool uses the codes that apply to it; a code never changes meaning between tools.

In a Dockerfile

FROM debian:bookworm-slim
RUN apt-get update \
 && apt-get install -y --no-install-recommends ca-certificates curl \
 && curl -fsSL https://get.otfabric.io/iec101ctl \
    | env OTF_UNMANAGED_INSTALL=/usr/local/bin sh \
 && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["iec101ctl"]

Scripts, CI and containers has GitHub Actions and GitLab CI examples and shows how to use a simulator as a test fixture.

Protocols

The README on GitHub has the full feature list, examples and changelog.

go-iec60870-5

The IEC 60870-5 telecontrol family in one module: IEC 101 on serial lines, IEC 102 for meter readings, IEC 103 for protection relays and IEC 104 over TCP/IP, each as controlling and controlled station, on shared FT 1.2, link-layer and time-tag packages. IEC 104 keeps TLS, IEC 62351-5, file transfer and redundancy groups. Pure Go, standard library only.

go get github.com/otfabric/go-iec60870-5
  • IEC 101
  • IEC 102
  • IEC 103
  • IEC 104
GitHub

iec60870-5-interop

Independent IEC 60870-5 implementations in containers behind one contract, per companion standard: IEC 101 (lib60870-C, cB-Sigma, digitalpetri), IEC 102 (gisce/iec870ree, REE profile), IEC 103 (vitusdong, ARIEC103, Open103, go-iecp5 cs103) and IEC 104 (lib60870-C, OpenMUC j60870, wendy512, cB-Sigma, part5). OT Fabric's own go-iec60870-5 stack is published behind the same contract, one image per standard, for testing your stack against.