10.5. Connecting to Virtual Machines and Containers via VNC

You can use your favorite VNC clients to connect to and manage containers and virtual machines. To do this, you need to complete these steps:

  1. (Recommended) Secure VNC connections on the node with SSL.
  2. Enable VNC access in the desired virtual machine or container.
  3. Connect to the virtual machine or container with a VNC client.

The sections below describe these steps in details.

10.5.1. Securing VNC Connections with SSL

To set up SSL for all VNC connections on the node, do the following:

  1. Acquire an SSL certificate and key from a trusted certificate authority.

  2. Configure the VNC server to use the certificate and key:

    # prlsrvctl set --vnc-ssl-certificate <path_to_crt_file> --vnc-ssl-key <path_to_key_file>
    

To disable VNC encryption, specify empty arguments. For example:

# prlsrvctl set --vnc-ssl-certificate '' --vnc-ssl-key ''

10.5.2. Enabling VNC Access to Virtual Machines

To enable VNC access to a virtual machine, you need to do the following:

  1. Enable VNC support in the virtual machine.

  2. Specify the TCP port number on the physical server that will be used to listen to VNC connections for the virtual machine.

    Note

    A unique port number must be specified for each virtual machine where you plan to connect via VNC.

  3. Set a password to secure your VNC connection.

You can perform all these operations with a single command. For example:

# prlctl set MyVM --vnc-mode manual --vnc-port 5901 --vnc-passwd XXXXXXXX

The changes will come into effect on the next virtual machine start.

10.5.3. Enabling VNC Access to Containers

To enable VNC access to a container, you need to do the following:

  1. Make sure you have a valid user account in the container to be able to log into it.

  2. Make sure the container is running.

  3. Set the VNC mode and password for the container. For example:

    # prlctl set MyCT --vnc-mode manual --vnc-port 6501 --vnc-passwd XXXXXXXX
    

    Note

    Port number must be unique for each container you open VNC access to. In the auto mode, correct port numbers are assigned automatically. In the manual mode, you need to make sure port numbers are unique yourself.

10.5.4. Connecting with a VNC Client

After you have enabled VNC access to the virtual machine or container, you can connect to it with your favorite VNC client. To do this, you need to pass the following parameters to the VNC client:

  • IP address of the server where the virtual machine or container is hosted.
  • Port number and password you specified when enabling VNC access.
  • Valid user account in the virtual machine or container.