Accessing a virtual device from an enterprise network

Foreword

Genymotion instances are accessible through the HTTPS port 443. The display of the virtual devices uses WebRTC connections through the non-standard port range 51000 to 51100 (UDP or TCP). To work around this, UDP and TCP are relayed by the STUN/TURN server by default if the port range 51000–51100 is unreachable. This will fail if the local network has tight security.

Your local network has tight security

You may need to whitelist the STUN/TURN server IP if your local network has tight access security. To retrieve TURN server IPs to whitelist, use the dig command:

dig turn-paas.genymotion.com +short.

Alternatively, you can use your own TURN server to forward WebRTC connections.

The Genymotion instance has no public IP

The Virtual Device display is rendered via WebRTC. If the host machine is not directly connected to the Genymotion instance via its public IP, the Genymotion instance will need to communicate with the public TURN/STUN server. If the instance has no public IP, WebRTC communication will fail and the device display will remain black. The solution is to use your own TURN/STUN server within the virtual network to forward WebRTC. To do so, we will explain how to set up a TURN/STUN server and configure the Genymotion instance to use it.

Use your own TURN server

See the instructions in this page for configuring the Genymotion device to use your own TURN server.

Installing a TURN server on Linux

We recommend using CoTURN on Ubuntu Server 20.04 LTS. Steps:

sudo apt-add-repository universe

sudo apt update && sudo apt upgrade

sudo apt-get install coturn

This configures CoTURN to listen on port 443 for UDP and TCP.

listening-ip = xxx.xxx.xxx.xxx

user=genymotion:123456

(You can also use static users as shown in the file with multiple users.)

sudo systemctl status coturn

If everything is in order, you should see coturn started and listening on port 443.

> Note: You may need to add inbound rules to your TURN/STUN server firewall to allow connections to TCP and UDP port 443 from your Genymotion instance.

Configuring the instance to use your TURN server

You need to configure your Genymotion instance to forward WebRTC to your STUN/TURN server.

Web UI

Command Line

Info

With a script

You can automate the settings with a script like:

#!/bin/bash
adb shell "setprop persist.webrtcd.turn-uri turn:TURNServerIP:443;\
setprop persist.webrtcd.stun-uri stun:STUN_IP:443;\
setprop persist.webrtcd.turn-username username1;\
setprop persist.webrtcd.turn-password password1"

The instance now uses your TURN/STUN server

The Genymotion instance will use your TURN/STUN server on port 443 for WebRTC connections.

Back to top

[This section ends Foreword content and moves on to the core TURN server workflow.]

Use your own TURN server (repeat emphasis for configuring WebRTC)

This section reiterates how to set up a TURN server and connect it to the Genymotion instance for WebRTC.

Installing a TURN server on Linux

We recommend CoTURN on Ubuntu Server 20.04 LTS. See above steps for installation and configuration.

Configuring the instance to use your TURN server

After you configure coturn, you must forward WebRTC to the TURN server from the Genymotion instance.

Web UI guidance (7.0.0)

Verifying Coturn and firewall rules

You may need to add inbound rules to your TURN/STUN server firewall to allow connections to TCP and UDP port 443 from your Genymotion instance.

Configuring the instance to use your TURN server (Web UI)

The Web UI (7.x) shows a visual TURN & STUN section where you input:

After entering values, click APPLY to save.

Use your TURN server within the virtual network

If you run TURN/STUN inside the same virtual network, ensure the Genymotion instance can reach the TURN/STUN server IP on port 443.

Example network diagram

Virtual Cloud Network with Linux/Windows hosts, Genymotion Device Image, and a TURN/STUN server. The host computer connects to the Genymotion Cloud Network through the WebRTC path, using the TURN/STUN server as needed.

How to proceed

1) Install CoTURN on Linux as described above.

2) Create a user and password for CoTURN.

3) Ensure coturn is configured to listen on port 443 and that the server IP is whitelisted if needed.

4) Reboot and verify coturn status.

5) In Genymotion, configure the TURN & STUN URIs to point to your TURN/STUN server.

6) Apply the configuration and test connectivity.

Additional notes

[END OF CONTENT]