Configuration
To configure AmsNAT, open the file StaticRoutes.xml, which is located in the TwinCAT installation directory under the path TwinCAT\3.1\Target. In this file, define the attribute "RemoteNetId" for each route as shown subsequent.
<?xml version="1.0" encoding="UTF-8"?>
<TcConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.beckhoff.com/schemas/2015/12/TcConfig">
<RemoteConnections>
<Route>
<Name>CX-111111</Name>
<Address>10.0.10.8</Address>
<NetId RemoteNetId="5.19.8.122.1.1">10.0.10.8.1.1</NetId>
<Type>TCP_IP</Type>
</Route>
<Route>
<Name>CX-222222</Name>
<Address>10.0.20.8</Address>
<NetId RemoteNetId="5.19.8.122.1.1">10.0.20.8.1.1</NetId>
<Type>TCP_IP</Type>
</Route>
</RemoteConnections>
</TcConfig>
The actual AmsNetId assigned to the remote ADS device is specified with the attribute "RemoteNetId". It does not have to be unique. Only the AmsNetId of the target system defined in the field <NetId> is known in the TwinCAT system with configured AmsNAT function.
Restart the TwinCAT system service in order to activate the preset configuration of the AmsNAT function. To do this, switch the TwinCAT system from Run mode to Config mode. If TwinCAT is already in Config mode, reopen this in order to load the settings made.