Troubleshooting
Intermittent PLC programming access over VPN when ping works
Short answer
Ping proves only that small ICMP packets cross the VPN. Intermittent PLC programming access comes from three causes: a firewall rule that never allows the programming session, a missing return route or gateway on the PLC, or a tunnel MTU below 1500 bytes that drops full-size packets. Test the port, read the router log, then fix the first cause that fails.

On this page
A remote PLC that answers ping but intermittently refuses the programming software has a working layer-3 path and a failing session path. Ping proves only that small ICMP packets cross the VPN in both directions. The programming session adds three things ping never exercises: a stateful firewall decision on the programming port, a return route from the PLC back to the VPN router, and full-size packets that must fit the tunnel MTU. Work through them in that order — prove the port with a TCP connect test, read the router log to rule the tunnel in or out, then fix the forwarding rule, the return route, or the measured MTU. Each section below ends with the result that decides the next step.
Separate reachability from the programming session #
ICMP carries ping. Most PLC programming links run over TCP, and the software in this setup connects on a fixed programming port — confirm the exact port number and protocol in your software's documentation before writing any rule. A router can forward echo while dropping, or never forwarding, the session's first packet, so a ping reply is not evidence that the port is reachable. The same echo-versus-session split appears inside the plant too: why an industrial PC pings an S7-1500 but runtime stays disconnected walks that variant.
- From the engineering PC, run
Test-NetConnection 192.168.1.30 -Port 25425in PowerShell, where 192.168.1.30 is the example PLC address. ExpectTcpTestSucceeded : True. - Repeat at least ten times, record each result with a timestamp, and repeat once inside a failure window.
- If the software connects over UDP,
Test-NetConnectioncannot test it; judge by the software's own connect result. - In the fault state, ping replies while the port test fails. That combination moves the investigation to the forwarding rule, the return route, or the MTU.
Read the router log before changing anything #
Intermittent success has two families of cause: the tunnel state changes, or the tunnel stays up and the packet path is wrong for certain traffic. The router's log separates them. In the router vendor's remote-management portal, select the failing router on the devices page, run the troubleshoot export, and open System.log, which holds the device's full log. Search it for VPN-related entries and align their timestamps with your failure records.
| Observation during a failed attempt | Likely cause | Where to fix it |
|---|---|---|
| Ping replies, port test fails, no VPN log events | Forwarding rule, return route, or MTU | The three sections below |
| VPN down or reconnect entries at the failure timestamps | Tunnel instability | WAN link quality and keepalive settings |
| Works at some sites, never at others, same template | Overlapping LAN subnets | Return-route section |
| Session opens, then stalls during upload or monitoring | Tunnel MTU below the path's needs | MTU section |
No VPN state change inside a failure window means the tunnel was stable and the fault sits in forwarding, routing, or MTU. A reconnect entry at the failure time means the session died with the tunnel — investigate the WAN link and that site's keepalive settings before touching the path.
Let the firewall pass the programming port #
The site router's firewall decides every connection on its own: the session's first packet arriving from the VPN interface must match a rule that forwards it to the LAN. ICMP is often allowed by one broad rule, while the programming port has no rule at all — or a rule scoped to a single source address that stops matching when the client's VPN address rotates.
Open the rule set for traffic from the VPN interface to the LAN and confirm a rule that accepts the protocol your software documents — TCP in this setup — on destination port 25425 toward the PLC address, with a source range covering the whole VPN client pool, for example 10.5.0.0/24, not one address. Rerun the port test: it must return TcpTestSucceeded : True on every attempt, not on a majority.
Check the PLC side as well. Controllers limit how many programming sessions run at once, and a session left open by a dropped tunnel can hold a slot until the controller times it out, so the next connect attempt fails on a healthy network. Read the connection diagnostics on the CPU or in the programming software and clear stale sessions before retesting.
Give the PLC a return route to the VPN client subnet #
Routed remote access needs two properties at every site: the VPN hub holds exactly one route to that site's PLC subnet, and the PLC sends replies for remote addresses back to the site router. Missing either one produces exactly the hit-and-miss behavior of an unstable tunnel.
Subnet overlap is the most common way the first property breaks. Fleets built from one template often share a single LAN subnet across sites, and the hub can route that subnet to only one tunnel, so access succeeds only at the site that currently owns the route. List the LAN subnet of every site; any duplicate means renumber those LANs or translate addresses at the router, because routes alone cannot resolve an overlap.
For the second property, read the default gateway on each PLC. It must be the site router's LAN address — for a PLC at 192.168.1.30, the router at 192.168.1.1. A blank or foreign gateway means the PLC answers only inside its own subnet and the remote PC receives nothing. On a Siemens S7-1500, the gateway is part of the CPU's Ethernet port configuration, and the vendor's support guidance treats that gateway entry as required for access over a VPN. Verify the whole path with tracert -d 192.168.1.30 from the engineering PC: the hop list must pass through that site's router LAN address and end at that site's PLC, never another site's.
Measure the tunnel MTU with a don't-fragment sweep #
MTU is the largest IP packet an interface sends without fragmenting. VPN encapsulation adds header bytes, so the tunnel MTU sits below the 1500-byte Ethernet default. Pings are small and pass; programming transfers send full-size segments. A segment larger than the path MTU with the DF (don't fragment) bit set is dropped, and if ICMP fragmentation-needed messages are filtered anywhere on the path, the sender never learns — the session opens, then stalls on upload, download, or online monitoring. A TCP connection that is established but carries no payload is that signature; why a gateway shows a TCP connection but sends no payload traces the same signature on an edge gateway.
Find the real number instead of assuming one. From the engineering PC, run ping 192.168.1.30 -f -l 1472, where -f sets the DF bit and -l sets the payload in bytes; 1472 is 1500 less the 28-byte IP and ICMP header. Reduce the payload in steps of 20 until replies return, then narrow to the largest passing payload. The path MTU equals that payload plus the 28-byte header.
Worked example. At a failing site, ping 192.168.1.30 -f -l 1472 returns Packet needs to be fragmented but DF set, and 1452 fails the same way. At 1392 the replies return, so the path MTU is 1392 + 28 = 1420 bytes. Set the tunnel interface MTU to 1420 bytes at both ends of the tunnel. Where the router offers TCP MSS clamping, set the clamp to 1420 - 40 = 1380 bytes, the MTU less the 20-byte IP and 20-byte TCP headers. Confirm with ping 192.168.1.30 -f -l 1392: it must reply, and the same command at 1412 must still fail — the DF path now ends exactly at the tunnel.
The header cost depends on the tunnel type, so measure rather than copy a figure — GRE tunnel MTU and MSS fragmentation with IPsec works the same arithmetic for that tunnel family.
Acceptance test and the decision #
Schedule the upload window with production so a CPU stop cannot endanger anyone. From the same engineering PC and VPN client that showed the fault:
- Export the troubleshoot archive and read
System.logfor the test window: no unexpected VPN down or reconnect entries. - Run the port test 20 times over several minutes: 20 of 20 report
TcpTestSucceeded : True. - Run
tracert -dto the PLC: the path passes through that site's router and no other. - Run the don't-fragment ping at the computed payload: replies return with no fragmentation-needed message.
- Go online in the programming software and upload the full program: it connects on the first attempt and completes without a stall or timeout.
The decision, by what the checks showed:
- Port test fails while ping replies and the log shows no VPN events — the forwarding rule: add or widen it for the programming port.
- Port test fails and the PLC's gateway is blank or points elsewhere — the return route: set the gateway to the site router's LAN address and renumber any duplicated subnet.
- Session opens, then stalls on a transfer — the MTU: set the measured tunnel MTU and the matching clamp.
- VPN reconnect entries at the failure timestamps — the tunnel: stabilize the WAN link and keepalive settings before touching anything else.
When the download fails outright rather than intermittently, ping works but PLC program download fails over remote access is that same case written out step by step.
Questions asked
Does the programming port number change any of these checks?
In this setup the software connects on TCP port 25425. Confirm both the number and the protocol in your software's documentation before writing rules, because another package can use a different port or UDP entirely. Every check here — the firewall rule, the connect test, the MTU sweep — then uses that port and protocol instead of the example ones.
What MTU value should the tunnel be set to?
The value you measure, not a default. The largest payload that answers the don't-fragment sweep, plus the 28-byte IP and ICMP header, is the path MTU — in the worked example, 1392 + 28 = 1420 bytes. Apply it at both ends of the tunnel; any value at or below the measured MTU works, and lower values only waste payload capacity.
Why does one site always work and another never, with the same configuration everywhere?
That pattern points at overlapping LAN subnets, not at the tunnel. With the same subnet configured at two sites, the hub's route points at whichever tunnel registered most recently, so both sites look correct while only one is reachable — until the other reconnects. List every site's LAN subnet; a duplicated pair is the fault, and renumbering one LAN is the fix.
Can the PLC itself refuse a connection while the network is healthy?
Yes. Controllers limit how many programming sessions run at once, and a tunnel that drops mid-session can leave one occupied until the controller times the session out. The symptom is a connect attempt that fails even though the port test passes. Open the connection diagnostics on the CPU or in the programming software, clear the stale session, and retest before changing any network setting.
What does MSS clamping change, and is it a substitute for setting the MTU?
Clamping lowers the maximum segment size end hosts announce during the TCP handshake, so senders produce segments that already fit the tunnel and never depend on fragmentation-needed messages arriving. It complements a correct tunnel MTU and is the safer fix wherever ICMP is filtered. Set the clamp to the tunnel MTU less the IP and TCP header overhead, then rerun the sweep and the upload.

