IMDHMIControls LibraryShop main store

Troubleshooting

SCADA gateway cycles Connecting and Disconnected: subnet fix

Industrial networks Published 8 min read

Short answer

When one SCADA gateway cycles between Connecting and Disconnected while another reaches the same PLC, the endpoints disagree about addressing. In the case behind this article a /16 site network met a PLC still set to /24: the test gateway reached the PLC, but the PLC sent its replies to a router that was not there. Compare both masks with the AND arithmetic shown, then test the PLC's TCP service port from the gateway host instead of ping.

On this page
  1. What the Connecting to Disconnected cycle tells you
  2. Compare the two subnet masks before anything else
  3. Worked example: a /16 test gateway against a PLC left on a /24
  4. Test the PLC's service port instead of ping
  5. What each observation decides
  6. When the port answers but the gateway still cycles
  7. Questions asked

When a test SCADA gateway cycles between Connecting and Disconnected while the production gateway talks to the same PLC, start with subnet masks, not passwords or licenses. In the case behind this checklist, the site ran a /16 network and the PLC still carried its old /24 mask, so the two machines disagreed about which addresses were local: the test gateway's requests arrived, but the PLC sent its replies toward a router that was not there. Correcting the test gateway's subnet settings restored the connection. The checks below read the status cycle, compare both masks with the arithmetic shown, test the PLC's TCP service port from the gateway host instead of ping, and sort the results into network work versus driver and access-protection work.

What the Connecting to Disconnected cycle tells you #

A few seconds of Connecting followed by Disconnected is a timeout signature: the gateway opened a connection attempt and got no handshake back. It is not a license message and not a tag-database problem, because the session never came up and there was nothing to read. Expect the status to keep flipping until the fault is fixed; the driver retries on its own timer.

A production gateway connected to the same PLC proves exactly one thing: the PLC serves sessions to that machine, at that address. It says nothing about the test host's address, mask, default gateway or switch path. Use the production machine as a reference for settings, never as proof that the network is fine.

Ping cannot arbitrate here either. This PLC had ping disabled, which is common on controllers, so a failed ping means nothing and a passing one proves little. The test that answers the question is a TCP connection attempt to the service port itself, run from the machine that owns the route.

This is the timeout family that leaves HMI values showing question marks at the panel; here you are simply watching the same failure from the server side.

Compare the two subnet masks before anything else #

Every IPv4 host runs the same test on each destination: it ANDs the destination address with its own mask and compares the result with its own network. Equal means local, so it resolves the destination's hardware address on the switch and sends directly. Not equal means remote, so it hands the packet to its default gateway and depends on a router that exists, is reachable, and knows a way back. When two endpoints hold different masks, one of them is wrong about this, and the failure is one-directional, which is what makes it hard to see. Sitting on the same switch and VLAN proves Layer 2 only; this decision happens at Layer 3.

The scale of a mistake matters: a /16 mask is 255.255.0.0 and declares 65,534 addresses local (2^16 − 2), while a /24 mask is 255.255.255.0 and declares 254 local (2^8 − 2). A site whose standard moved from a /24 design to a /16 design leaves every controller still carrying the old mask on the wrong boundary, and the boundary, not the cable, decides where replies go.

Collect these before changing anything:

  • from the PLC: its IP address, mask and default gateway, read from the Ethernet interface settings in its engineering software;
  • from the SCADA host: the same three values from its own network settings;
  • from the network drawing: whether a router actually exists on this VLAN.

If either machine computes a different network for the other's address, you have found the fault, and no driver setting will compensate for it.

Worked example: a /16 test gateway against a PLC left on a /24 #

Inputs #

  • Site LAN 10.10.0.0/16, mask 255.255.0.0. The /16 site network and the leftover /24 are the values from the case behind this article; the 10.10.x.x host addresses are illustrative.
  • PLC: 10.10.20.50, mask 255.255.255.0, no default gateway configured, on a flat switch-only VLAN.
  • Test gateway host: 10.10.44.12, mask 255.255.0.0.
  • Production gateway host: 10.10.20.61, mask 255.255.0.0.
  • Service under test: S7 communication, TCP port 102.

The rule in words #

A host treats a destination as local when destination AND my mask equals my address AND my mask. Local means send directly; remote means send to the default gateway.

Arithmetic #

Test gateway, outgoing: 10.10.44.12 AND 255.255.0.0 = 10.10.0.0, and 10.10.20.50 AND 255.255.0.0 = 10.10.0.0. Equal, so the test gateway treats the PLC as local and puts its TCP SYN straight onto the switch, which delivers it because both machines share the VLAN.

PLC, return path: its own network is 10.10.20.50 AND 255.255.255.0 = 10.10.20.0. The client's address lands at 10.10.44.12 AND 255.255.255.0 = 10.10.44.0. Different, so the PLC classifies the test host as remote and sends its reply toward a default gateway that does not exist on this VLAN. The handshake never completes.

Production host, why it works: 10.10.20.61 AND 255.255.255.0 = 10.10.20.0, equal to the PLC's own network, so the PLC answers directly and the session holds. The production machine's /16 mask never came into play, because its address already sits inside the PLC's /24.

Result and decision #

The test gateway shows a few seconds of Connecting per attempt, then Disconnected, repeating; the production gateway stays connected. Two AND operations per machine explain both.

Put the test host inside the PLC's current /24 with a matching mask: an address such as 10.10.20.99 with mask 255.255.255.0 makes both directions local (client view: 10.10.20.50 AND 255.255.255.0 = 10.10.20.0, its own network; PLC view: 10.10.20.99 AND 255.255.255.0 = 10.10.20.0, its own network), and the connection comes up immediately. That is the immediate fix. The durable fix, done in a maintenance window, is to bring the PLC's mask to the site's /16 so every endpoint computes the same boundary. The threshold to remember: if either endpoint's AND result for the other's address differs from its own network, the mask pair is the fault — fix it before touching the driver, the license or the PLC's security settings.

Test the PLC's service port instead of ping #

  1. Run the test on the SCADA gateway host itself. The route decision belongs to that machine's mask, so a port test from a laptop proves nothing about the gateway.
  2. In PowerShell, run Test-NetConnection -ComputerName 10.10.20.50 -Port 102 with the PLC's address in place of the illustrative one. Port 102 is the TCP service port S7 communication uses, so this one test covers the whole path the driver needs.
  3. Read the TcpTestSucceeded line. True means the handshake to port 102 completed: addressing, routing, VLAN and the PLC's TCP service all work, and any remaining fault lives above the network. False means nothing answered.
  4. On False, redo the AND arithmetic from the worked example on both machines and check each default gateway. If a router legitimately separates the subnets, confirm both endpoints name it and it can route back; planning that path is the same work as choosing PLC to SCADA communication over long distances.
  5. On True with the status still cycling, stop auditing the network and move to the session layer below.

One safety rule belongs here: never change a PLC's IP address or mask while it controls a running process — the change drops every open session at once, including I/O and operator connections nobody is watching — so mask corrections go into a maintenance window like any other controller change.

What each observation decides #

Observation What it proves Decision
Production gateway connected to the same PLC The PLC serves sessions at that address Treat it as a settings reference only; audit the test host's mask, gateway and VLAN
Ping to the PLC fails Nothing; ping is often disabled on controllers Drop ping; test TCP port 102 from the gateway host
TcpTestSucceeded is False The handshake dies before the service: mask mismatch, missing route, VLAN or switch fault Run the AND arithmetic on both endpoints; align the masks or repair the route
TcpTestSucceeded is True, status still cycles The network is innocent; the session layer is not Compare driver device settings, then the PLC's access-protection settings

When the port answers but the gateway still cycles #

A True port test exonerates everything below the session: masks, routes, switch configuration and the PLC's TCP service. Two places remain.

First, the driver's device configuration on the test gateway. Compare it entry by entry against the production gateway: the PLC's address, the controller identification the driver asks for, and the connection type. A mismatch there refuses or misdirects the session with the network otherwise perfect.

Second, the PLC's own communication settings. Modern controllers offer password-based access protection, many add certificate-based protection, and the permitted connection types are configurable; a driver that cannot satisfy them is refused after the TCP handshake, which looks identical to a network fault from the status display. The documented routes are to match the protection settings using the vendor's own procedure, or to connect the third-party client through the controller's integrated OPC UA server. These settings live in the controller's project inside its engineering software, so read them there and match the protection level and permitted connection types against what the driver presents.

Restated as the decision: an unreachable port is a mask, route, VLAN or switch job on the machines' own settings; a reachable port with a cycling driver is a settings job on the gateway or the PLC's protection. Work them in that order and the cycle stops at whichever layer owns the fault.

Questions asked

Can I test port 102 with telnet instead of PowerShell?

Yes. Telnet to the PLC's address on port 102; a blank screen with a blinking cursor means the service accepted the TCP connection, and a refused or silent timeout means it did not. On current Windows clients telnet is not installed by default, which is why the Test-NetConnection cmdlet is the quicker choice: it is already present and prints a clear True or False result for the TCP test.

Why does the status cycle between Connecting and Disconnected instead of failing once?

A gateway driver keeps each device connection alive: after a failed attempt it waits for its own retry interval and starts a new session, so every attempt shows Connecting while the handshake is outstanding and Disconnected when the timeout expires. The interval is the driver's retry timer, not network jitter, and the loop continues until the fault is fixed. A badly tuned session timeout on either side can also loop reconnects even when the network path is healthy.

How do I find each device's current mask and default gateway?

On the SCADA host, run ipconfig in a command prompt and read the IPv4 Address, Subnet Mask and Default Gateway lines for the network adapter that faces the PLC. On the PLC, read the same three values from its Ethernet interface settings in the engineering software or from its built-in web page. Write both sets down and apply the AND arithmetic from the article to each pair before changing anything.

Will my test gateway conflict with the production gateway on the same PLC?

A controller serves several clients at once up to its documented connection resources, and the count is finite and model dependent. Normally a second gateway connects alongside the first without trouble, but if the resource pool is already exhausted, new sessions are accepted and then dropped, which looks exactly like the Connecting to Disconnected cycle. Keep test clients connected only while needed and check the controller documentation for its connection resource count.

Keep reading

  • Selection guide

    Choosing PLC to SCADA communication over long distances

    For PLC-to-SCADA communication over long distance, choose the transport by reach and connection behavior: fiber Ethernet for a continuous long link (one span rated 2 km), RS-485 where serial fits, extenders or radio on existing pairs, dial-up or leased-line modems on phone service. Direct copper Ethernet fails at 100 m per segment; the SCADA driver or OPC service, not the PLC's ASCII modem commands, carries the protocol.

    Industrial networks

  • How-to

    How to build a virtual PLC test bench for protocol practice

    One laptop runs the whole bench: a Modbus TCP server simulator, a master test client, a Node-RED OPC UA server and a SCADA trial connect over loopback, so you can practice addressing, sessions, scaling, alarms and fault diagnosis without a PLC. Work through three bounded projects and finish with seven pass criteria you can defend.

    Industrial networks

  • How-to

    How to create a SCADA PLC communication alarm for link loss

    Create the SCADA-to-PLC communication alarm from the data server's diagnostic item, not from a PLC bit. Browse to IsPresent under the PLC shortcut's Diagnostic Items folder, create a digital alarm in FactoryTalk Alarms and Events with IsPresent = 0 as the active condition, and it activates about 20 seconds after the link drops; IsPresent(10) shortens that to about 10 seconds. A heartbeat bit cannot do this because it travels over the link it monitors and goes unreadable exactly when the link fails.

    SCADA and data logging