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:
- Add the Universe repository if not activated:
sudo apt-add-repository universe
- Update and upgrade Ubuntu:
sudo apt update && sudo apt upgrade
- Reboot.
- Install the server:
sudo apt-get install coturn
- Enable the TURN service at boot by editing /etc/default/coturn and set TURNSERVER_ENABLED=1.
- Edit /etc/turnserver.conf. Un-comment listening-port=3478 and change it to 443.
This configures CoTURN to listen on port 443 for UDP and TCP.
- Un-comment listening-ip and replace with your Ubuntu server IP.
listening-ip = xxx.xxx.xxx.xxx
- Add a user and password for the Genymotion device. For example:
user=genymotion:123456
(You can also use static users as shown in the file with multiple users.)
- Edit /lib/systemd/system/coturn.service and add AmbientCapabilities=CAP_NET_BIND_SERVICE in the [Service] section.
- Reboot the system.
- Verify CoTURN started correctly and is listening on port 443 with:
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
- Go to the Configuration panel of your instance.
- In the TURN & STUN box, fill the form. TURN and STUN server URIs use the syntax:
- turn:TURNServerIP:443
- stun:STUNServerIP:443
- Replace TURNServerIP and STUNServerIP with the public IP or URL of your TURN/STUN server.
- The fields you fill include:
- TURNURI
- STUNURI
- Turn username
- Turn password
- Click APPLY to apply the changes.
Command Line
- You can also set these properties via the CLI (using the same values above).
Info
- TURNServerIP and STUN_IP refer to the public IPs of your STUN/TURN server.
- username1 and password1 refer to the credentials defined in the turnserver.conf file.
- geny_instance_IP is the Genymotion instance IP.
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"
- TURNServerIP and STUN_IP refer to the public IPs of your STUN/TURN server.
- username1 and password1 refer to the credentials in the turnserver.conf file.
- geny_instance_IP is the Genymotion instance IP.
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)
- Go to the Configuration panel of your instance.
- In the TURN & STUN box, fill the form with:
- turn:xxx.xxx.xxx.xxx:443
- stun:xxx.xxx.xxx.xxx:443
- where xxx.xxx.xxx.xxx is your TURN/STUN server IP or URL.
- Click APPLY to apply the changes.
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:
- TURN URI
- STUN URI
- Turn username
- Turn password
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
- If the Genymotion instance has no public IP, WebRTC connectivity relies on the TURN/STUN server to relay traffic.
- The configuration steps in the Web UI differ slightly across versions, but the core concepts remain turning on TURN support and pointing to the correct URIs.
[END OF CONTENT]