VNC (Internet)

To access a cloud phone through the Internet, ensure that the VNC client has been installed on the local device. Establish an SSH tunnel first, and then use the VNC client to access the cloud phone.

The local device can run the Windows, Linux, Android, or Mac OS. This topic uses the Windows OS as an example.

Constraints and Limitations

  • When purchasing a Cloud Phone server, you must enable VNC login in Advanced Settings. If this configuration item is unavailable or disabled, the cloud phone cannot be accessed using VNC.
  • Only cloud phones with the rx1.cp.c60.d32.e1v1.qemu flavor support the VNC connection.

Prerequisites

The cloud phone must be in the Running state.

Preparations

Before establishing an SSH tunnel, ensure that the SSH service has been installed on the local device that will be used to access the cloud phone. For details, see How Can I Know Whether the SSH Service Has Been Installed on My Local Device? You also need to log in to the Cloud Phone console and complete the following preparations:

  1. Obtain the project ID of the region where the target cloud phone is located. The operations are as follows:
    1. Locate the username in the upper right corner, hover the mouse over it, and select My Credentials from the drop-down list.

    2. Choose API Credentials. In the Projects area, obtain the project ID of the region where the cloud phone to be accessed is located.

      Example: region CN East-Shanghai1

      If the project ID contains more than 32 characters, the first 32 characters are used as the username of the SSH tunnel to be established.

  2. Select an idle port on the local device to connect to the cloud phone.

    Run the netstat -an command to check whether the port is idle.

    As shown in the following figure, port 6667 is occupied (displayed as Listening) by another program, and port 1234 is idle.

  3. Obtain the VNC listening port of the cloud phone. The operations are as follows:
    1. On the Cloud Phone console, in the left navigation pane, choose Instances, and click the name of the target cloud phone.

    2. In the Application Port area, obtain the VNC application listening port, for example, 7399 in the following figure.

  4. Obtain the public IP address of the server. The operations are as follows:

    On the Cloud Phone console, choose Servers in the left navigation pane, locate the target server, and obtain the value of IP Address.

    If there are multiple servers, identify the server which the cloud phone belongs to based on the cloud phone name. For example, if the cloud phone name is cph-test-1-00001, the corresponding server name is cph-test-1.

  5. Obtain the local path for storing the private key file corresponding to the server key pair, that is, the local path for storing the private key file when the key pair is created in 6, for example, C:/Users/Administrator/Downloads/KeyPair-a49c.pem. The path is case insensitive.

    If the private key file corresponding to the server key pair is lost, see What Can I Do If the Private Key File Is Lost?

Step 1 Establish an SSH Tunnel

  1. Open the CLI on your local device. The following uses Windows 10 as an example:

    Press Win+R, enter cmd in the Run dialog box, and press Enter.

  2. Run the following command to establish an SSH tunnel:

    ssh -L Local idle port:localhost:Cloud phone listening port SSH tunnel username@Public IP address -i Private key file path -Nf

    The parameters are described as follows:

    • Local idle port: indicates any selected local idle port. The port is mapped to the cloud phone application port. For details, see 2.
    • Cloud phone listening port: indicates the VNC application listening port of the cloud phone. For details, see 3.
    • SSH tunnel username: indicates the project ID of the region where the cloud phone is located. For details, see 1.
    • Public IP address: indicates the public IP address of the server. For details, see 4.
    • Private key file path: indicates the local path for storing the private key file corresponding to the server key pair. For details, see 5.

    Assume that the local idle port is 1234, the listening port of the cloud phone is 7399, the SSH tunnel username is 05e1aexxx, the public IP address is xxx.xxx.xxx.xxx, and the private key file path is C:\Users\Administrator\Downloads\KeyPair-a49c.pem. Run the following command:

    ssh -L 1234:localhost:7399 05e1aexxx@xxx.xxx.xxx.xxx -i C:\Users\Administrator\Downloads\KeyPair-a49c.pem -Nf

    This command sets up an SSH tunnel from the local PC to the cloud phone. The tunnel uses local port forwarding and listens to port 1234 of the local PC. When port 1234 of the local PC is accessed, the communication data is forwarded to port 7399 of the cloud phone.

    After the command is executed, the SSH program forwards packets through the tunnel in the background. If no error is reported, or "Authorized users only. All activities may be monitored and reported." is displayed, the SSH tunnel is successfully established.

Step 2 Use the VNC Client to Access the Cloud Phone

Use the VNC client, such as VNC Viewer, to access the cloud phone.

To download VNC Viewer, log in at https://www.realvnc.com/en/connect/download/viewer/.

Enter the IP address and port number based on the VNC client usage, for example, 127.0.0.1: Local idle port.

Local idle port is the idle port used in 2.