Remote TWS API Connections with Trader Workstation
Connecting an API to a remote Trader Workstation
If you want to connect TWS/ IB Gateway from a remote server, uncheck the “Allow connection from localhost only” setting. Under the “Trusted IPs” section, click “Create” and enter the IP Address detected in “Accept incoming connection attempt from <IP Address>” into “Trusted IPs”.
“Trusted IPs” does not accept subnet (e.g. /27, /28). It only accepts single IP Addresses. Assuming a remote computing cluster /27 which has 32 IP Addresses, a remote computing cluster will randomly assign one of the computing nodes to connect to TWS in every connection. To make this happen, every Private IPv4 Address of the subnet must be put into the “Trusted IPs” (You can also exclude the first IP Network Address and the last IP Broadcast Address of the subnet).
Accepting an API connection from TWS
For security reasons, by default the API is not configured to automatically accept connection requests from API applications. After a connection attempt, a dialogue will appear in TWS asking the user to manually confirm that a connection can be made:
Untrusted IPs attempting to make a connection will be denied without prompting.

To prevent the TWS from asking the end user to accept the connection, it is possible to configure it to automatically accept the connection from a trusted IP address and/or the local machine. This can easily be done via the TWS API settings:


