Troubleshooting
How to monitor Modbus TCP remote I/O for random connection failures
Short answer
Baseline the STBNIP2212 rack's web diagnostics and its switch port counters, confirm nothing filters TCP 502 after the IT changes, then mirror the worst offender's port and capture a full day with Wireshark. A rack failing 0.1% of each day loses about 86 seconds of Modbus communication, so the capture will hold the event; compare counters against a rack that never fails.

On this page
Start with the counters, finish with the capture. Read the affected module's own diagnostics and its switch port statistics for a few days to build a baseline, confirm that nothing on the path filters TCP 502, then mirror the worst offender's switch port and record a full day of traffic with Wireshark from the clean workstation at the site. Work in that order: counters tell you which layer fails — physical, congestion, or policy — and the capture shows the exact packet that died. When the trouble began the day a SCADA upgrade and new security gear landed, a filter on the Modbus TCP service port is suspect number one, because security teams treat that port as non-standard and block it as a matter of course. A rack that misbehaves 0.1% of each day goes dark for roughly 86 seconds, so a full-day capture will hold at least one failure.
Read the module and switch counters first #
The Advantys STBNIP2212 network interface module at the center of this case serves its own web diagnostics, and the vendor's FAQ documents the kernel and web firmware as field upgradable, so what you can read depends on the release each rack runs. Record the exact version before comparing racks, because one may sit on the 2.2.7 web release while a neighbor runs something older. Read the release notes as well: this NIM's firmware history includes a documented fix for outputs that could energize for 500 ms under certain conditions, which is why a firmware change on a rack that drives field outputs belongs in a maintenance window, never as a live experiment during diagnosis.
Collect this set from every failing rack and from one rack that has never failed:
- Module web page: uptime, power-supply diagnostics, and local I/O status. A rack that rebooted looks to the client like a network timeout, not a power event.
- Negotiated speed and duplex on the module's switch port. This NIM's Ethernet port runs at 10 Mbps, but read the switch status page and confirm it rather than assume.
- Link transitions on that port: each one marks a cable, connector, negotiation, or rack-power event.
- Receive errors (CRC and alignment): climbing errors point at the physical layer.
- Discards: frames dropped without errors point at congestion, buffering, or policy at that hop.
- Utilization across a full polling cycle, sampled on the failing rack and the clean rack alike.
Read increments over a fixed interval rather than cumulative totals from devices with different uptimes, and note existing values before anything clears them. Switches fail too: when a port stops passing traffic altogether rather than dropping the odd frame, why a managed switch WAN port stops passing traffic walks through the switch-side causes.
Why the Modbus TCP port is the first suspect after an IT change #
A Modbus TCP client opens TCP connections to service port 502, and because that is not a normal IT service, firewalls and security appliances frequently block it; the standard guidance in Modbus TCP master documentation is to review the firewall rules for anything that blocks incoming TCP 502. The two failure signatures differ. A rule that drops the port outright fails every time, along that path, the same way. Intermittent trouble points instead at changing policy, session limits, or inspection load on a security device that only trips under bursts.
A ping from your remote workstation settles none of this. It tests neither the production client's permitted path nor the module's willingness to answer on the service port, and switching carries traffic freely inside a subnet while routing and security policy govern everything that crosses a boundary. Verify what the contractor actually changed and what the rollback actually restored — 'rolled back' is a claim to check in the switch logs and saved configurations, not proof. And when the evidence points at the device side of the conversation rather than a firewall, why a custom Modbus TCP slave fails on port 502 covers how the service port itself fails and conflicts.
Worked example: capture window for a rack that drops 0.1% of its day #
Inputs, with their source:
- Failure rate: 0.1% of each day — the reported symptom for this rack.
- Day length: 24 h, which is 86,400 s by definition.
- Module port speed: 10 Mbps on the STBNIP2212's Ethernet port, as reported for this hardware; confirm the negotiated rate on the switch before relying on it.
- Capture window: one full day, the sensible first window for an intermittent fault.
The rules, in words: expected lost time per day equals the failure fraction multiplied by the seconds in a day, and raw line capacity equals the port speed divided by 8 bits per byte.
The arithmetic:
- 0.001 × 86,400 s = 86.4 s of failed Modbus communication per day
- 10,000,000 bit/s ÷ 8 bit/byte = 1,250,000 byte/s, about 1.25 MB/s of raw line rate — before preamble, inter-frame gap, and TCP/IP overhead take their share, so usable payload is lower.
Result: on an average day this rack loses about 86.4 s of communication, almost certainly in several separate events rather than one.
Decision: record the whole day, keep every file, and the capture will hold at least one failure on most days. During a failure window, compare the port's utilization against the 1.25 MB/s line rate. Traffic pinned near the line rate means a scan or backup is saturating that port, and the fix is to move such traffic off the segment. Low utilization with a flood of new connection attempts means connection churn is exhausting the embedded interface — the failure mode to expect when a security scanner probes a device that processes each attempt in software.
Mirror the port and capture a full day #
The capture host should be a dedicated machine at the site, not the SCADA client; for a permanent diagnostic post in the cabinet that you can reach from another time zone, an industrial panel PC puts the remote-access screen, storage, and capture interface in one box.
Then work through this sequence:
- Map every repeat offender to its switch and physical port, and note the shared uplinks, routed boundaries, and security devices between the polling client and each rack.
- Establish remote access to the switch and record how your own session reaches it, so reconfiguring a port cannot cut you off.
- Save the switch configuration and set a recovery path before touching anything.
- Mirror the module port in both directions to a spare port, leaving the production port's VLAN, speed, and forwarding settings untouched.
- Align clocks across the workstation, the polling client, and the switch, and record any offset that remains.
- Use bounded capture files with storage sized for the whole window, and record everything — ARP, TCP handshakes, and resets included — because filtering to Modbus payloads can hide the very event that prevented a connection.
- Log every production failure timestamp, and pull the switch counter deltas for each of those windows.
- Check the capture tool's own drop statistics before concluding that a packet never arrived; a saturated mirror destination silently omits traffic that reached the wire.
Turn the evidence into a decision #
Match what the capture and counters show to one of these branches:
- Requests leave the client and TCP SYNs to the service port get no reply: filtering or session policy. Compare the failure timestamps with the IT scan, backup, and patch calendars.
- Responses stop mid-exchange while retransmissions pile up: loss or endpoint overload. Correlate with scan bursts and concurrent clients; when several masters write to the same device the churn compounds, and two SCADA servers writing to one PLC over Modbus TCP covers exactly that pattern.
- Receive errors climb on the module port: the physical layer. Rework the connector, replace the patch lead, and check rack power for dips — each link transition in the counter log marks the moment to examine.
- Discards climb without receive errors: congestion or policy at that hop. Check duplex settings on both ends and the loading on shared uplinks.
- Only some racks fail while the failing rack's counters stay clean: compare its configuration against a never-failing rack. Two devices claiming one IP address redirects traffic intermittently, and firmware differences change how an embedded stack absorbs scan load.
- For correlation beyond the capture window: an open-source monitor such as NetXMS polls both Modbus/TCP and SNMP, runs on Linux or Windows on the site workstation, and builds the time series that ties failures to scan schedules. Its probes add traffic and may take a different path than the production client, so treat its graphs as corroboration, not as proof about the production path.
For this case, the decision: baseline the counters on the two worst offenders and one clean rack for a few days, verify that the security work left no rule touching the Modbus service port, then mirror and record a full day. Utilization near the line rate during scan windows means move the scans off that segment. Churn at low utilization means the scan targets or rates change. Climbing receive errors mean the copper gets fixed first. And if a full week passes with no captured event and quiet counters, stop blaming the network and work through the rack itself: uptime, power diagnostics, and local I/O status.
Questions asked
How much storage does a full-day capture need at that port speed?
Size storage from the line rate, not from your polling traffic. The 10 Mbps port tops out at 1.25 MB/s, so a fully saturated day would fill about 108 GB (1.25 MB/s across 86,400 s). Real Modbus polling sits far below that, so a ring of a few tens of gigabytes split across several files is generous, and it still survives a day when a scan or backup saturates the segment.
The switches are unmanaged and cannot mirror a port. What are the options?
Insert visibility into the cable run instead: a small managed switch between the module and its switch port provides a mirror port, or an Ethernet tap provides both directions on separate capture interfaces. Both mean briefly disconnecting the rack, so agree a maintenance window first, confirm the inserted device negotiates the module's link speed cleanly, and verify the capture host sees both directions before you consider the job done.
Should I update the module firmware while diagnosing?
Not during the diagnosis. A new release resets your baseline: counters, timing, and even the diagnostic pages change, so you lose the comparison between a failing rack and a clean one. Record what each rack runs first, complete the capture campaign on one version, and only then schedule a maintenance window to bring every rack to the same level, re-reading the counters from scratch afterwards.
What if the failures never happen while the capture is running?
Then the trigger is scheduled, and the schedule becomes the evidence. Keep the capture running across night, weekend, and shift boundaries, and pull the IT scan, backup, and patch calendars for the site. Security scans and backup windows are the usual triggers on a network that only misbehaves for a few seconds a day. If a full week passes with no captured event and quiet counters, move the search inside the rack: uptime, power diagnostics, and local I/O status.

