IEC 60870-5-104 (IEC 104) is the TCP/IP telecontrol protocol of power system SCADA, and the most widely deployed member of the IEC 60870-5 family. It carries the data model of IEC 101 over TCP instead of a serial link. A controlling station (the control centre) talks to controlled stations (substations, RTUs, generation and storage assets) on TCP port 2404. Each station has a common address, and each data point an information object address. The control centre runs interrogations, receives spontaneous events, and sends commands, often with select-before-operate.
Where you meet it
- Links between grid control centres and substations
- Solar parks, wind farms and battery storage connected to a grid operator
- RTUs and gateways in distribution and transmission networks
Quickstart
From the command line
Install iec104ctl with curl -fsSL https://get.otfabric.io/iec104ctl | sh, or on Windows irm https://get.otfabric.io/iec104ctl.ps1 | iex (all install options). No station at hand? Start a simulated one:
iec104ctl server startand talk to it from another terminal:
# What does this station hold? (general interrogation)iec104ctl client interrogate --ip 127.0.0.1 --ca 1
# Watch events and measured values as they arrive, until Ctrl-Ciec104ctl client monitor --ip 127.0.0.1 --interrogate
# Operate a disconnector with select-before-operateiec104ctl client command --ip 127.0.0.1 --type double --ioa 5001 --value off --mode sbo
# Is the link alive, and how fast?iec104ctl client ping --ip 127.0.0.1With IEC 62351-5, both ends authenticate with certificates and every ASDU is authenticated, or encrypted with AES-256-GCM:
iec104ctl server start --secure --security-cert station.pem --security-key station.key \ --security-trust scada.pem --roles viewer
iec104ctl client interrogate --ip 127.0.0.1 --secure --security-cert scada.pem \ --security-key scada.key --security-trust station.pem --dpa aes-256-gcmFrom Go
go get github.com/otfabric/go-iec60870-5Connect, interrogate and synchronize the clock:
package main
import ( "context" "fmt" "log" "time"
"github.com/otfabric/go-iec60870-5/asdu" "github.com/otfabric/go-iec60870-5/iec104/client")
func main() { ctx := context.Background()
// Dial connects and sends STARTDT. Every ASDU the station sends // reaches the handler, in order. c, err := client.Dial(ctx, "10.0.0.5:2404", client.WithReconnect(client.Reconnect{}), client.WithHandler(client.HandlerFunc(func(a *asdu.ASDU) { for _, obj := range a.Objects { if m, ok := obj.(asdu.MeasuredFloat); ok { fmt.Printf("%s ioa=%d value=%g quality=%s\n", a.Cause, m.IOA, m.Value, m.Quality) } } }))) if err != nil { log.Fatal(err) } defer c.Close()
// General interrogation of station 1. data, err := c.Interrogate(ctx, 1, asdu.QOIStation) if err != nil { log.Fatal(err) } fmt.Printf("interrogation returned %d ASDUs\n", len(data))
if err := c.ClockSync(ctx, 1, time.Now()); err != nil { log.Fatal(err) }}What go-iec60870-5 and iec104ctl support
| Roles | Controlling station (client) and controlled station (server) |
| Client | STARTDT/STOPDT, general and counter interrogation, read, clock sync, commands with select-before-operate, test command, automatic reconnect |
| Server | Many sessions, routing by type identification, redundancy groups with an acknowledged event queue |
| Link layer | Full APCI state machine: I/S/U frames, k/w windows, t0–t3 timers |
| Security | TLS (IEC 62351-3), and the IEC 62351-5 A-Profile of IEC TS 60870-5-7:2025: station association with X.509 certificates, session keys, every ASDU authenticated (HMAC) or encrypted (AES-256-GCM), role-based access control. Alone or combined with TLS |
| Files | Download, upload and the file directory, in both roles |
| Dependencies | Go standard library only |
Interoperability
iec60870-5-interop runs five independent IEC 104 stacks in containers: MZ Automation lib60870-C, OpenMUC j60870, wendy512/iec104, cB-Sigma/iec60870 and pascaldekloe/part5. go-iec60870-5’s IEC 104 client and server pass independent runs against all five. cB-Sigma is the only open-source implementation of IEC 62351-5 in its 2023 edition, and the application-layer security is tested against it in both directions; mutual TLS (IEC 62351-3), file transfer, interrogation groups and redundancy groups are tested against several of the stacks. That makes IEC 62351-5 interoperable with cB-Sigma, not conformance-tested: no certified test equipment has been used, so keep TLS with client certificates where both ends support it.