PLC IP Address Configuration for OPC UA Server Communication
This reference consolidates the engineering rules for assigning IP addresses to a PLC, connecting an engineering station or OPC UA client to that controller, and avoiding the most common failure modes that surface when the controller IP is changed at runtime. It is written for commissioning engineers and SCADA integrators working with SIMATIC S7-1500/S7-1200 controllers and equivalent EtherNet/IP- or Modbus TCP-capable PLCs that expose an OPC UA server endpoint.
1. IP Address Assignment Methods
Every PLC Ethernet interface requires an IPv4 address from one of three sources. The selection depends on commissioning phase, network policy, and whether the controller has a display or vendor discovery tool.
| Method | Mechanism | Typical Use | Notes |
|---|---|---|---|
| Static (manual) | Operator enters IP, subnet mask, gateway in engineering tool or HMI | Production cells, fixed-role controllers | Required for OPC UA endpoints referenced by DNS-less clients |
| DHCP | External DHCP server leases IP from a pool | Floors with centralized IP management | DHCP must reserve the IP for the PLC MAC (static lease) so the OPC UA endpoint does not drift |
| BOOTP / vendor tool | Controller broadcasts BOOTP/DHCP request with vendor class identifier; engineering tool replies | Initial commissioning without display | Older Siemens S7-300/400 and pre-firmware S7-1500 controllers |
| Default / link-local | Pre-configured IP such as 192.168.0.1 or 169.254.x.x | Out-of-the-box first connection | Must be changed before the controller is placed on a routed network |
For an OPC UA server, the IP must be deterministic. A SCADA client that resolves the endpoint through DNS still depends on the DNS A-record being kept in sync; the deterministic approach is to assign a static IP and either publish an A-record or store the IP directly in the OPC UA client configuration.
2. Direct PC-to-PLC Connection: Auto-MDIX
Modern PLC Ethernet PHYs implement Auto-MDIX (Automatic Medium-Dependent Interface Crossover) defined in IEEE 802.3ab. The PHY detects the TX/RX pair polarity on the connected device and automatically configures the internal crossover, so a straight-through Cat 5e/Cat 6 patch cable works in every case.
| Controller family | Auto-MDIX support | Minimum firmware |
|---|---|---|
| SIMATIC S7-1500 (all CPU types) | Yes | Firmware V1.0 and later |
| SIMATIC S7-1200 | Yes | Firmware V4.0 and later (V1.0 only on PROFINET port) |
| ET 200SP / ET 200MP PN interfaces | Yes | Firmware V3.0 and later |
| SIMATIC S7-300/400 CP343/CP443 | Partial | Check CP type; older CP343-1 Lean required crossover |
Procedure for a one-to-one link with a SIMATIC S7-1500 CPU:
- Connect the engineering PC NIC directly to the CPU PROFINET port (X1 or X2) using a standard straight-through patch cable.
- Set the PC NIC to an IP address in the same subnet (for example, controller 192.168.0.1 / 24, PC 192.168.0.2 / 24).
- Open TIA Portal, select Online > Accessible nodes. The CPU appears in the list once it responds to the DCP identify broadcast.
- If the CPU is not in the list, disable any active VPN client and Windows firewall rules on the private profile, then repeat the scan.
3. Switched Network Topology
When an Ethernet switch sits between the engineering PC and the PLC, the link on every segment is between a DTE (PC or PLC) and a DTE-class switch port. Both segments therefore use straight-through cabling. Mixing crossover in a switched plant is a frequent commissioning fault that produces "link up / no L2 traffic" symptoms.
| Topology segment | Required cable | Reason |
|---|---|---|
| PC NIC to switch port | Straight-through (TIA-568B both ends) | DTE-to-DCE |
| PLC PROFINET port to switch port | Straight-through (TIA-568B both ends) | DTE-to-DCE |
| Switch port to switch port (cascade) | Straight-through or crossover depending on port MDIX | Managed switches auto-negotiate |
| PC NIC to PLC (no switch) | Straight-through | Auto-MDIX handles polarity |
Industrial managed switches (SCALANCE XC/XB/XR, Stratix 5700/5400, Hirschmann RS20/RS30) add PROFINET prioritization, LLDP topology discovery, and port-level diagnostics. These are recommended for any segment that carries an OPC UA session because the QoS classification keeps the OPC UA publish/subscribe traffic from being delayed by bursty PROFINET real-time frames.
4. Vendor Engineering Tools for IP Discovery and Assignment
If the controller IP is unknown, every major vendor ships a discovery tool that locates the device via DCP (PROFINET), CIP (EtherNet/IP), or a vendor multicast beacon. Always use the tool that matches the controller's native protocol, not a generic Windows network scanner.
| Vendor | Tool | Function | URL |
|---|---|---|---|
| Siemens | PRONETA | PROFINET network analysis, IP assignment, topology, port diagnostics | Siemens PRONETA support entry |
| Siemens | TIA Portal > Online > Accessible nodes | Project-integrated device discovery and IP edit | TIA Portal commissioning manual |
| Siemens | SIMATIC Automation Tool | Bulk IP assignment across a project without opening TIA | SIMATIC Automation Tool download |
| Siemens | Primary Setup Tool (legacy) | Initial IP and PROFINET device name for S7-300/400/ET 200 | Primary Setup Tool entry |
| Rockwell | BOOTP-DHCP Server | Static DHCP assignment by MAC for ControlLogix/CompactLogix | Rockwell support portal |
| Schneider | EcoStruxure Control Expert (Unity Pro) | IP edit on Modicon M340/M580 Ethernet ports | Schneider Electric support |
PRONETA is the recommended tool when you have no DNS, no DHCP, and the controller IP is unknown. It performs a Layer-2 multicast scan, lists every PROFINET device on the segment, and lets you assign a new IP without opening the TIA Portal project.
5. OPC UA Server IP Configuration on SIMATIC S7-1500
The OPC UA server on a SIMATIC S7-1500 is activated per project in TIA Portal under CPU properties > OPC UA > Server. The server listens on TCP port 4840 by default; the URL exposed to clients is constructed as:
opc.tcp://<IP>:4840
For a CPU at 192.168.178.151 on the 192.168.178.0/24 subnet, the client uses:
opc.tcp://192.168.178.151:4840
Configuration steps in TIA Portal:
- Open the CPU device configuration and select the PROFINET interface X1 (or X2 if the OPC UA server is bound to that subnet).
- Set IP address and Subnet mask on the Ethernet addresses page. Note the value — it will become the OPC UA endpoint.
- Under OPC UA > Server > General, enable Activate OPC UA Server.
- Set Port (default 4840). If a firewall sits between the SCADA server and the PLC, open TCP 4840 (or the chosen port) bidirectionally.
- Under OPC UA > Server > Security, select the security policy (None, Basic128Rsa15, Basic256Sha256, Aes128Sha256RsaOaep, Aes256Sha256RsaPss). Anonymous authentication is permitted only if explicitly enabled.
- Under OPC UA > Server > User authentication, configure the certificate trust list and the user/password mapping that the SCADA client will use.
- Compile and download the project. The server endpoint is then reachable at the configured IP.
6. Network Stack Reset on IP Change
When the IP address of a SIMATIC CPU is changed in TIA Portal (or via PRONETA / SIMATIC Automation Tool) and the change is downloaded to the controller, the PROFINET stack reinitializes. Every active TCP socket on that interface is closed: OPC UA sessions, S7 communication PUT/GET, open Modbus TCP connections, and HMI connections.
Recovery sequence after a planned IP change:
- Stop the SCADA / OPC UA client. The pending session timeout will release the certificate trust entry on the next reconnect.
- Update the OPC UA endpoint URL in the SCADA client configuration (e.g., Ignition, WinCC, Kepware) to the new IP.
- Download the IP change. The CPU restarts the PROFINET stack — this is observable as a brief link-down/link-up on the switch port.
- Restart the SCADA client. It opens a new TCP connection on port 4840 and re-handshakes the OPC UA session.
- Verify the client shows the server certificate as Trusted. If the certificate was bound to the old IP, accept the new certificate and rotate the trust list.
| Symptom after IP change | Root cause | Fix |
|---|---|---|
| OPC UA client reports Bad_CommunicationError or Bad_ConnectionClosed | TCP socket torn down by stack reset | Reconnect client; verify new endpoint URL |
| Client shows Bad_CertificateHostnameInvalid | Certificate SAN contains the old IP | Regenerate server certificate with new IP, re-trust |
| HMI shows "Connection interrupted" | S7 connection closed by IP change | Update HMI connection target IP, reconnect |
| PRONETA no longer lists the CPU | PC and CPU on different subnets | Set PC NIC to the new subnet, rescan |
7. DHCP and BOOTP Service for Initial Commissioning
The Siemens BOOTP-DHCP-Server tool (or the equivalent Rockwell BOOTP-DHCP server for EtherNet/IP controllers) lets you map a MAC address to a fixed IP at first power-up. This is the standard approach for a rack of controllers where every PLC ships from the factory with a default link-local address and needs a deterministic address before the OPC UA client is configured.
Procedure with the Siemens BOOTP-DHCP-Server:
- Install S7BOOTP from the Siemens support site. Run as administrator.
- Connect the PC directly to the PROFINET network segment that contains the unconfigured CPU.
- Click Start to begin the broadcast listener. The CPU appears with its MAC address once it powers up and issues a BOOTP request.
- Double-click the entry, assign an IP and subnet mask, then click Apply. The server sends a DHCP ACK with the static mapping.
- Click Stop to end the broadcast listener — leaving it running will conflict with any production DHCP server.
- Verify in TIA Portal Online > Accessible nodes that the CPU is now reachable on the assigned address.
8. Subnetting and OPC UA Reachability
OPC UA TCP traffic is unicast and IP-routable. If the SCADA server sits on a different subnet from the PLC, a router or Layer-3 switch must forward TCP port 4840 (or the configured port) between the two. Validate the path with the following checks before commissioning the OPC UA client:
- From the SCADA server, ping the PLC IP. A successful ICMP reply confirms the L3 path is open; OPC UA failure is then a TCP/credential issue, not a routing one.
- Run
Test-NetConnection -ComputerName 192.168.178.151 -Port 4840(PowerShell) ornc -vz 192.168.178.151 4840(Linux) to confirm the port is reachable. - Confirm the PLC default gateway is set if the SCADA client is on a different subnet. Without a gateway, the CPU will not accept TCP from outside its own subnet even if the cable is connected.
- Confirm the SCADA host firewall permits outbound TCP 4840. Windows Defender Firewall with the Domain or Private profile active will silently drop the SYN.
| Verification | Command | Expected result |
|---|---|---|
| L3 reachability | ping 192.168.178.151 |
Reply from 192.168.178.151: bytes=32 time<10ms TTL=64 |
| TCP port open | Test-NetConnection -Port 4840 |
TcpTestSucceeded: True |
| OPC UA discovery | Client "Discover" / "GetEndpoints" | Endpoint list returned, server certificate presented |
| Session active | Client status / read of a known tag | Good status, value matches PLC |
9. Troubleshooting Matrix
| Problem | Probable cause | Diagnostic | Resolution |
|---|---|---|---|
| PC cannot see PLC at all | PC and PLC on different subnets, no gateway, or wrong cable | Check NIC IP, ping PLC, check switch port LED | Set PC NIC to same subnet, replace cable, use known-good switch port |
| PLC visible in PRONETA but not in TIA | Firewall blocking PG/PC protocol, or PG/PC interface set wrong in TIA | Disable firewall, set PG/PC interface = S7ONLINE access point > Intel NIC | Update Windows firewall rule to allow S7 protocol (TCP 102) and port 4840 |
| OPC UA client cannot connect, port 4840 closed | OPC UA server not activated, or wrong port | Read CPU online diagnostics, check OPC UA > Server > Port | Activate server, correct port, download project |
| Connection drops after IP change | Network stack reset closed TCP socket | Read client log, look for ConnectionClosed | Update client endpoint URL, re-trust certificate, reconnect |
| Client trusted old certificate, new IP rejected | Certificate hostname/SAN mismatch | Inspect certificate in client trust store | Regenerate server certificate, add to trust list, retry |
| OPC UA browsing returns empty | No server interface enabled, or no tags published | Check OPC UA > Server > Server interfaces | Enable at least one interface, ensure the tag DB has the Accessible from OPC UA attribute set |
| Reads return Bad_UserAccessDenied | User authentication configured but client not sending credentials | Check User authentication settings, client session settings | Configure username/password on client, or enable anonymous if policy allows |
10. Commissioning Verification Checklist
Run this checklist before handing the cell over to operations.
- PLC has a static IP documented in the as-built drawing and in the OPC UA client endpoint URL.
- The OPC UA server is activated in the TIA Portal project and downloaded to the CPU.
- Port 4840 (or the configured port) is open in any firewall between the SCADA server and the PLC subnet.
- The SCADA client can browse the OPC UA address space and the published tags appear with the correct data type.
- A read of a known tag returns Good quality and the current PLC value.
- The server certificate is trusted on the client and a backup copy is stored in the project archive.
- A forced IP change (e.g., from PRONETA) is performed once to verify the recovery procedure; the SCADA client reconnects automatically after the endpoint URL is updated.
- The PLC, switch, and SCADA server are all referenced in the network diagram with IP, mask, gateway, and VLAN ID.
11. Notes on Vendor-Specific Behavior
SIMATIC S7-1500 / S7-1200: OPC UA server is a project option that must be activated in the device configuration. The endpoint is bound to the PROFINET interface IP. The CPU allows up to 40 OPC UA sessions (varies by CPU type, see CPU manual for exact limit).
ET 200SP CPU / IM: The OPC UA server is available on the PROFINET interface of the CPU or the IM 155-6 PN with firmware V4.2 and later. Use the same endpoint URL rule.
Third-party OPC UA stacks (Unified Automation, Matrikon, Kepware): When the OPC UA server is hosted on a non-Siemens gateway, the endpoint URL is built the same way: opc.tcp://<gateway-IP>:<port>. The gateway device is the device whose IP must be static and whose port must be reachable.
SCADA clients (WinCC Unified, Ignition, FactoryTalk Optix): All three read the endpoint URL from a configuration page and rebuild the OPC UA session on every reconnect. Updating the URL and restarting the client service is sufficient after an IP change — no certificate rotation is needed unless the server-side certificate SAN contains the IP.
12. FAQ
Do I need a crossover cable to connect a PC directly to a SIMATIC S7-1500?
No. S7-1500 CPUs implement Auto-MDIX on every PROFINET port from firmware V1.0 onward, so a standard straight-through Cat 5e/Cat 6 patch cable works in both directions. Crossover cables are not required and are not stocked as spares for current-generation SIMATIC hardware.
What IP should I assign to the PLC before I configure the OPC UA server?
Assign a static IP from the cell subnet, with a matching subnet mask and (if the SCADA server is on a different subnet) the default gateway of that subnet. Document the IP in the as-built drawing and use it verbatim in the OPC UA client endpoint URL: opc.tcp://<IP>:4840.
Can I change the PLC IP while the OPC UA client is running?
You can, but every active TCP session on the PROFINET interface is closed when the IP change is applied because the network stack reinitializes. The SCADA client will report a connection error. To recover, stop the client, update the endpoint URL to the new IP, restart the client, and re-trust the server certificate if the IP is part of the certificate SAN.
Do I need a BOOTP/DHCP server to give the PLC its first IP?
Not on an S7-1500. You can set the IP directly from PRONETA, the TIA Portal Online > Accessible nodes view, or the SIMATIC Automation Tool. BOOTP is mainly used for bulk commissioning of S7-300/400/ET 200 stations that do not have a display. After the initial assignment, switch to a static IP or a static DHCP lease so the OPC UA endpoint is deterministic.
Why does the OPC UA client show "Bad_CertificateHostnameInvalid" after an IP change?
The server certificate was generated with the old IP in the Subject Alternative Name (SAN). The OPC UA specification requires the hostname in the URL to match the certificate. Regenerate the server certificate in TIA Portal under OPC UA > Server > Security, download it to the CPU, and add the new certificate to the SCADA client trust list.