How do controllers select a gateway?
Controllers select gateways based on subnet similarity ranking, prioritizing gateways whose subnets best match the target's IP addresses when establishing connections.
When a new session with a Remote Control Target is started as described in this page, the controller tries to establish a connection with the selected Remote Control Target using the network information reported by the target itself during the periodic heartbeat that is sent at the frequency specified in this property.
If one or more gateways are listed on the "All Remote Control Gateways" page described here, the controller will also try to reach the target using all the gateways listed on that page. More precisely, the gateways list will be sorted using a rank value that is calculated between each target's IP address and each gateway's IP address. Basically, the gateway whose subnet is most similar to one of the target's IPs will have a higher priority in the list.
For example: Let's say that the target has the following IPs:
192.168.1.68, 10.10.10.5, 10.8.10.47
and the gateways listed on the RC Server are the following:
Gateway1 = 10.188.112.2, Gateway2 = 192.168.1.254,
In this case, the gateway list will be [192.168.1.254, 10.188.112.2] because the subnet 192.168.x.x of Gateway2 matches the subnet of the Target's IP 192.168.1.68, and its rank value is greater than that of Gateway1's IP 10.188.112.2.