1. Problem Statement
When using the LHTTP library on a SIMATIC ET 200SP Open Controller running SoftwarePLC, name-based HTTP requests to cloud APIs fail with DNS timeout errors while direct IP-based requests succeed. The failure is caused by subnet separation between the SoftwarePLC virtual NIC (typically 192.168.x.x) and the Windows PC system NIC that owns the physical uplink to the corporate network or internet (typically 10.108.x.x or similar).
The PLC's IP stack cannot reach the DNS server configured for the Windows side because:
- The SoftwarePLC interface sits on an isolated internal subnet.
- The PC system interface sits on the plant network with default gateway and DNS settings.
- The
hwID := "Local~PC_communications_interface"string bridges outbound connections from the PLC into the Windows network stack, but only for IP-routed traffic. - DNS resolution requires that the DNS server IP be reachable through the PLC's routing table; if no router is defined for the PLC's subnet, or the DNS server address lies outside the PLC's local subnet, the resolver cannot issue a query.
LHTTP_ClientResult = 1 (communication error) or status = 16#80C1 class errors in STATUS output when using a hostname such as https://api.example.com/data. Switching the URL to the resolved IPv4 address (e.g., https://203.0.113.45/data) makes the same call succeed.
2. Affected Products and Firmware
| Component | Identifier | Firmware / Version Tested |
|---|---|---|
| SIMATIC ET 200SP Open Controller | CPU 1515SP PC2 (6ES7677-2DB42-0GB0) | FW V2.9 / V2.10 |
| SoftwarePLC | WinAC RTX (F) | V2.9 / V2.10 |
| LHTTP library | "LHTTP" (global library) | V1.4 / V1.5 |
| TIA Portal | STEP 7 / WinCC | V17, V18, V19 |
| Windows IoT / Windows 10 IoT Enterprise LTSC | PC system image | 2019 / 2021 |
| SIMATIC RT-VMM Network Adapter | Hyper-V virtual switch by Siemens | Bundled with ET 200SP OC image |
The LHTTP library ships as a global library in the Siemens LHTTP Application Example and is referenced inside the project via LibController / LibData function blocks such as LHTTP_Client.
3. Network Architecture on the Open Controller
The ET 200SP Open Controller runs two parallel operating systems on one device:
-
SoftwarePLC runtime (Windows / RTX): Executes the S7-1500 PLC program. The virtual NIC bound to the PLC program is typically
192.168.1.1 / 255.255.255.0. - PC system (Windows): A standard Windows installation that owns the physical Ethernet ports (X1, X2) of the device. This NIC has the real plant IP, default gateway, and DNS servers.
The two systems communicate through a Hyper-V virtual switch and the SIMATIC RT-VMM Network Adapter. The hwID parameter in the TCON function block selects which interface the TCP connection originates from:
| hwID String | Binds To | Routing Scope |
|---|---|---|
"Local~PC_communications_interface" |
Windows physical NIC | Plant / corporate / internet |
"Local~PLC_communications_interface" |
SoftwarePLC virtual NIC | PLC subnet only (192.168.x.x) |
| Empty / unspecified | Default (PC comm. interface) | Plant network |
When the PLC program issues an HTTP request through LHTTP, the underlying TCON binds the socket to the chosen hwID. The TCP handshake is relayed through Windows, so IP-routed traffic flows normally. DNS resolution, however, is performed by the PLC runtime itself, which means the DNS server IP must be reachable from the SoftwarePLC stack — not just from Windows.
4. Root Cause: DNS Server Outside the PLC Subnet
The TIA Portal device configuration under Properties > PROFINET interface [X1] > IPv4 addresses provides three fields:
- IP address
- Subnet mask
- Router (default gateway)
A separate section under Properties > DNS server accepts up to two DNS server IPv4 addresses. The PLC will only forward DNS queries to an address that is:
- On the same subnet as the PLC interface, OR
- Reachable through the configured router address.
If neither condition is met, DNS resolution fails with a TCP RST / ICMP unreachable equivalent on the PLC side, and the LHTTP call returns an error.
In the reported case:
- PLC subnet:
192.168.1.0/24 - Windows NIC:
10.108.x.x / 24with DNS servers in the10.108.x.xrange - No router configured in TIA Portal for the PLC interface
Direct IP connections still succeed because the Windows stack performs the routing once the TCP connection crosses the PC_communications_interface boundary — the PLC never has to resolve anything. Hostname connections fail because the PLC's resolver cannot reach 10.108.x.x directly and has no default route.
5. Solution Path A — Configure a Router in TIA Portal
The recommended fix is to add a router address in the PLC interface properties so that the PLC's resolver can forward DNS queries outside the local subnet.
Step-by-step
- Open the TIA Portal project containing the SoftwarePLC.
- Navigate to Devices & Networks and select the Open Controller.
- Open Properties > PROFINET interface [X1] > IPv4 addresses.
- Check "Use router" and enter the IP address of a router that the PLC can reach. Acceptable values:
- The Windows side IP of the Open Controller itself (e.g.,
10.108.x.1) if Windows IP forwarding is enabled — see Path B. - A plant router on the PLC subnet that also has a path to the Windows subnet.
- The Windows side IP of the Open Controller itself (e.g.,
- Navigate to Properties > DNS server and enter the plant DNS server IP (e.g.,
10.108.x.10). - Compile and download the hardware configuration to the SoftwarePLC.
- Cycle power on the Open Controller so the new routing table is loaded by RTX.
Verification
- From the TIA Portal Online & Diagnostics view, open PROFINET diagnostics > DNS. The configured DNS server should show as reachable.
- In the LHTTP test program, monitor
LHTTP_Client.status. A hostname call should now returnstatus = 16#0000withresponse_code = 200.
6. Solution Path B — Enable Routing on the Windows Side
If no physical router exists between the two subnets, the Open Controller's Windows installation can act as the router. The Windows NIC on the 10.108.x.x subnet and the SIMATIC RT-VMM virtual NIC (typically 192.168.1.1) sit on different subnets. Enable IP forwarding so the PLC's resolver can reach the Windows DNS server.
PowerShell steps (run elevated)
# Enable IP forwarding on Windows
Set-NetIPInterface -Forwarding Enabled
# Confirm
Get-NetIPInterface | Select-Object InterfaceAlias, Forwarding
# Optional: add a static route from PLC subnet to Windows subnet
route ADD 192.168.1.0 MASK 255.255.255.0 10.108.x.1 METRIC 1 IF <interface_index>
Replace 10.108.x.1 with the Windows side IP of the Open Controller. Once forwarding is enabled, configure the TIA Portal router as in Path A pointing to the Windows NIC IP.
7. Solution Path C — Local DNS Relay on the Windows Side
For plants where the IT department cannot add static routes or enable forwarding, deploy a lightweight DNS proxy on the Windows side of the Open Controller. The proxy listens on the SIMATIC RT-VMM adapter (192.168.1.1:53) and forwards queries to the corporate resolvers.
Recommended tools (free / open source)
- dnsmasq — small DNS forwarder, runs as a Windows service via Windows DNS service alternatives.
- Acrylic DNS Proxy — Windows-native, GUI configuration.
- Technitium DNS Server — supports forwarders and caching.
Example dnsmasq configuration
# /usr/local/etc/dnsmasq.conf
# Listen only on the SIMATIC RT-VMM adapter
listen-address=192.168.1.1
bind-interfaces
# Forward all queries to the corporate DNS
server=10.108.x.10
server=10.108.x.11
# Cache results
cache-size=1000
Then configure the TIA Portal DNS server field as 192.168.1.1 (the Windows side of the SIMATIC RT-VMM adapter). Because this address is on the same subnet as the PLC, no router is required in TIA Portal — the DNS server is considered local by the resolver.
Verification
# From the Open Controller Windows side
nslookup api.example.com 192.168.1.1
# Should return the corporate DNS response
8. Solution Path D — Host File Override (Engineering / Test Only)
For lab testing, populate the Windows side C:\Windows\System32\drivers\etc\hosts file with the resolved IPs of the cloud endpoints. Because the LHTTP socket is bound through hwID := "Local~PC_communications_interface", the Windows resolver performs the lookup. This is the same path that makes IP-address-based calls succeed.
# Example hosts entry
203.0.113.45 api.example.com
203.0.113.46 telemetry.example.com
9. Parameter Table — TCON / LHTTP Configuration
| Parameter | Recommended Value | Notes |
|---|---|---|
| TCON.hwID | "Local~PC_communications_interface" |
Routes through Windows NIC |
| TCON.InterfaceId | Leave default | Determined by hwID |
| TCON.ActiveEstablished | TRUE |
Active connection establishment |
| TCON.ConnectionType |
16#0B (TCP) |
HTTP uses TCP |
| LHTTP_Client.url | https://api.example.com/data |
Hostname must resolve |
| LHTTP_Client.method |
'GET' or 'POST'
|
Per API spec |
| LHTTP_Client.timeout | T#10s |
Adjust for slow networks |
| TIA Portal — Router |
10.108.x.1 (Windows NIC) |
Enables DNS off-subnet |
| TIA Portal — DNS server 1 |
10.108.x.10 or 192.168.1.1
|
Corporate or local proxy |
10. LHTTP Status / Error Code Matrix
| Status (Hex) | Status (Dec) | Likely Cause | Action |
|---|---|---|---|
16#0000 |
0 | Success | None |
16#7000 |
28672 | No job active | Trigger execute := TRUE
|
16#7001 |
28673 | Job running, busy | Wait |
16#7002 |
28674 | Job completed, ready for next | Read response
|
16#80C1 |
32961 | DNS / TCP error | Check router + DNS config |
16#80C3 |
32963 | Connection aborted | Check firewall on PC system |
16#80C4 |
32964 | TLS handshake failed | Validate certificate, time sync |
16#80C6 |
32966 | HTTP timeout | Increase timeout, check endpoint |
16#80C7 |
32967 | DNS resolution failed | Apply Path A / B / C above |
11. Verification Checklist
- Open a Windows command prompt on the Open Controller and run
nslookup api.example.com 10.108.x.10. Confirm the IP address is returned. - Run the same test against the configured TIA Portal DNS server IP. Confirm reachability.
- From the PLC program, call LHTTP with an IP-based URL — confirm
response_code = 200. - Call LHTTP with the hostname URL — confirm same response.
- Inspect the LHTTP
response_headerbuffer for theHost:field. It must contain the original hostname, confirming TLS SNI was negotiated. - Monitor
LHTTP_Client.diagnostics.infooutput DB for connection establishment time and DNS resolution duration.
12. Edge Cases and Field Notes
- IPv6 DNS servers: The SoftwarePLC resolver in RTX currently supports IPv4 DNS only. IPv6 resolvers are ignored even when configured.
- DNS over HTTPS (DoH): Not supported by the SoftwarePLC resolver. Use plain DNS (UDP/TCP 53).
- Multiple DNS servers: The PLC tries each in order. If the first server is unreachable, the second is queried after a 3-second timeout.
-
TLS SNI mismatch: If you replace the hostname with an IP in the URL, modern TLS endpoints will reject the handshake. Always keep the original hostname in
url. -
Plant VPN / Proxy: If the corporate network requires a web proxy, LHTTP does not support HTTP CONNECT or HTTPS proxying natively. Use the Windows system proxy settings and ensure
Local~PC_communications_interfaceinherits them. - Windows firewall: The first time LHTTP opens an outbound socket, Windows Defender Firewall prompts for permission. Allow access on the Windows side.
13. Diagnostic Procedure (5-Step)
- Confirm symptom: Toggle between hostname and IP URL in LHTTP. If only the IP works, DNS is the issue.
- Check PLC routing table: In TIA Portal Online & Diagnostics > Routing table, look for a default route.
- Check DNS field: Under Device properties > DNS, verify the address is correct and matches the subnet policy (local vs off-subnet).
-
Ping from Windows side:
ping 10.108.x.10from the Open Controller's Windows shell — must succeed. -
Test resolver: From the PLC, set DNS to
192.168.1.1and use Path C. If successful, the original DNS server was simply unreachable.
14. Alternate Platform Notes
For engineers migrating this pattern to other Siemens platforms:
- S7-1500 (non-OC): No Windows side; DNS must be configured as a direct field. The PLC must have a route to the DNS server or the DNS server must sit on the PLC's subnet.
- S7-1200: LHTTP not supported; use the Web Client instructions in TIA Portal. DNS behaves identically.
- LOGO! 8.4: Cloud connectivity via the LOGO! CMR; DNS is handled by the CMR router. Direct DNS configuration is not exposed.
- Third-party IPC (e.g., Beckhoff CX): No dual-stack separation; the PLC runtime owns the physical NIC directly. DNS resolution is straightforward.
Why does LHTTP work with IP addresses but fail with hostnames on the Open Controller?
The SoftwarePLC resolver runs on the PLC virtual NIC and only sends DNS queries to addresses on the PLC subnet or reachable through the TIA Portal-configured router. Windows performs the TCP routing, but it does not perform the DNS resolution. With IP-based URLs, no resolution is needed, so the call succeeds.
Do I need to configure a router in TIA Portal for DNS to work off-subnet?
Yes. The PLC will only forward DNS queries to addresses that are on its own subnet or reachable through the router IP configured under PROFINET interface > IPv4 addresses > Router. Point the router at the Windows NIC of the Open Controller or at a plant router with a path to the corporate DNS.
Can I use the SIMATIC RT-VMM Network Adapter as a router?
The RT-VMM adapter is a host-only virtual NIC and does not perform routing between subnets. Enable Windows IP forwarding (Set-NetIPInterface -Forwarding Enabled) and use the Windows side IP as the TIA Portal router entry. Alternatively, install a DNS proxy on the Windows side and point the PLC DNS field to 192.168.1.1.
What LHTTP status code indicates a DNS resolution failure?
Status 16#80C7 indicates DNS resolution failed. Status 16#80C1 covers general TCP/DNS class errors. Inspect the LHTTP diagnostics DB for the DNS error string returned by the Windows resolver relay.
Is editing the Windows hosts file a viable production workaround?
No. It is suitable only for commissioning. Host entries do not survive IP changes, do not support TLS SAN validation cleanly, and create a maintenance burden. Use a DNS proxy or a proper TIA Portal router configuration for production deployments.