Connecting to a PLC from a virtual machine can be challenging. In this article I show a step-by-step guide how to connect to a Siemens Simatic PLC. Although this process is probably be similar for other PLCs. I also show a few tips and tricks on how to debug the process.
- Check if you can see the PLC if you connect the PLC to your computer. If you get a ping reply, that is a yes.
- If you get a reply go to the next step. If not, fix the IP of the Ethernet port in the same range as the IP address of the PLC.
- Go to Control Panel > Network and Internet > Network Connections
- Right click the network adapter where the PLC is connected to and select Properties.
- Select Internet protocol Version 4 (TCP/IPv4)
- For IP address enter the same numbers as your PLC for the first three parts. For the last one give it a unique number. In this case not
.1, to prevent IP conflicts on your network. For example I used
- Try to ping the PLC again. If that works, start the VM and try to ping the PLC from inside the VM.
If that also works, you can check to which port the PLC is connected with:
> Test-NetConnection 192.168.0.1 ComputerName : 192.168.0.1 RemoteAddress : 192.168.0.1 InterfaceAlias : Ethernet0 SourceAddress : 192.168.11.128 PingSucceeded : True PingReplyDetails (RTT) : 1 ms
- Check which network connection the port is using, by selecting Properties of Ethernet0 in Control Panel > Network and Internet > Network Connections.
- Open your TIA project. Select your PLC and go to Online > Extended go online.
- Under PG/PC interface select he network connection you found at step 5 and click start search.
- Select GoOnline.