Connectivity to Remote Beckhoff TwinCAT PLC using NAT (Network Address Translation)
We have a Beckhoff TwinCAT PLC on Network X with the IP address
xxx.xxx.xxx.xxx. We want to use the TOP Server Beckhoff TwinCAT Ethernet driver on a PC on Network Y with IP Addressyyy.yyy.yyy.yyy.We have a Network Address Translation (NAT) device bridging the separate Networks X and Y, such that the Beckhoff TwinCAT PLC has a format
yyy.yyy.yyy.yyyIP Address mapped to it's actual IP address on Network X, such that requests from TOP Server on Network Y get forwarded to the correct IP Address on Network X.The same relationship is also configured in the opposite direction, with the TOP Server PC having a format
xxx.xxx.xxx.xxxIP Address mapped to it's actual IP Address on Network Y, so data from the Beckhoff PLC to thatxxx.xxx.xxx.xxxIP Address get forwarded to the TOP Server PC on Network Y.How do we configure the AMS Net ID routing to allowing communication?
In this situation, the NAT device is only mapping the IP Addresses. It is important to understand that Beckhoff TwinCAT communications also involves an AMS Net ID, which will not get mapped by a NAT device like the IP Address.
When configuring Beckhoff TwinCAT communications, it is necessary to define an AMS Net ID in two places:
- On the TOP Server PC, using the Beckhoff TwinCAT Remote Manager Utility, you configured an AMS Net ID for the local PC and also one for the remote TwinCAT PLCs you will be communicating with.
- On the Beckhoff TwinCAT PLC, it is necessary to configured an AMS Net ID for the remote TOP Server PC.Typically, the local IP Address is used as part of the AMS Net ID, i.e. if the local IP Address was 192.168.2.2, the AMS Net ID would be 192.168.2.2.1.1 .
However, it is important for this scenario using NAT to understand that the AMS Net ID does not have to be the same as the IP Address.
So, when using NAT in this type of architecture, you will do the following:
- On the TOP Server PC (on Network Y), when you define the remote AMS Net ID of the Beckhoff TwinCAT PLC, the IP Address will be the IP Address on the local Network Y that is mapped to the actual PLC IP Address on Network X, but the AMS Net ID will use the Actual IP Address of the PLC.
- IP Address Format:
yyy.yyy.yyy.yyy - AMS Net ID Format:
xxx.xxx.xxx.xxx.1.1
- IP Address Format:
- On the Beckhoff TwinCAT PLC (on Network X), the IP Address to the TOP Server will be the IP Address defined on the local Network X that is mapped to the actual IP Address of the TOP Server PC, but the AMS Net ID will use the Actual IP Address of the TOP Server PC as configured in the Beckhoff TwinCAT Remote Manager Utility.
- IP Address Format:
xxx.xxx.xxx.xxx - AMS Net ID Format:
yyy.yyy.yyy.yyy.1.1
- IP Address Format:
Essentially, when two networks are involved that have mapped IP Addresses, the IP Address is always defined as the mapped address of the target on the local network and the AMS Net ID is always defined using the actual IP Address of the target on the remote network.