Accessing a virtual device from an enterprise network (NAT)
With Genymotion Cloud PaaS, users give or get access to virtual devices through the Internet. Thus, they must be able to connect to them from their corporate network and configure them to make them reachable.
For every asset and webpage, Genymotion Cloud PaaS instances are accessible through the HTTPS port 443. However, WebRTC connections, needed to display the virtual devices in the web browser, use an alternative protocol relying on the non-standard port range 51003 to 51100 (UDP or TCP). This might cause problems to users who are behind a web proxy to access the Internet. To workaround this, UDP and TCP are relayed by our TURN server (default).
However, users and/or companies may want or need to use their own TURN server for their network infrastructure.
This section explains how to install and configure a custom TURN server. The server can be installed on a remote machine that needs to be accessible publicly within the company network.
Installing a TURN server on Linux
TIP
We recommend installing a CoTURN server which is available in the latest Ubuntu LTS Linux distribution (18.04LTS) and above.
To install a CoTURN server:
- If the Universe repository is not already activated, add it using
sudo apt-add-repository universe
. - Install the server using
sudo apt-get install coturn
. - Make sure the server restarts on boot by un-commenting
TURNSERVER_ENABLED=1
in/etc/default/coturn
file. - Modify the configuration file
/etc/turnserver.conf
to have the CoTURN server listen on port 443:- Make sure the server listens to port 443 by un-commenting
listening-port=3478
and changing it tolistening-port=443
- Add a user and password for your Genymotion virtual device by un-commenting
user=your-username:your-password
.
- Make sure the server listens to port 443 by un-commenting
- Restart your computer.
- Make sure the CoTURN server started correctly and that it is listening on port 443 by checking the most recent log file (
/var/log/turn_xxxx_2017-02-01.log
where xxxx changes at each server boot). - Make sure no other servers are running and listening on port 443, or CoTURN won't be able to use it.
Configuring the instance to use the TURN server
First, you need to authorize the TURN server public IP in AWS or GCP firewall rules so that it can access your virtual device.
Next, to make sure the web browser uses the TURN server, you must add its configuration to the web page that is served by the Genymotion device internal web server.
To do so:
Configure the TURN server from the instance webUI
To configure TURN or STUN, go to the Configuration section of your instance:
TIP
You can also reach the instance Configuration section with the URL https://X.X.X.X/configuration, where X.X.X.X is your instance public IP address.
Then go in the TURN & STUN section and fill the form:
Configure the embeddable page (iframe)
Connect to the device using SSH. For more information, you can refer to section Accessing a Genymotion virtual device from SSH.
From the
/data/www/iframe/
directory of theindex.html
page, add a TURN element in the options element:var options = { template: "god_default", god: true, token: (typeof token !== 'undefined') ? token : 'genymotion', turn: { urls: [ 'turn:TURNServerPublicIP:443?transport=tcp', 'turn:TURNServerPublicIP:443?transport=udp' ], username:'username1', credential:'password1' } };
TURNServerPublicIP
is your TURN server public IP.username1
is the username set inturnserver.conf
file.password1
is the password set inturnserver.conf
file.
WARNING
Don't forget to add a comma at the end of the previous line in the options structure.
Your web browser now uses the TURN server on port 443.