Language: EN


Remote Desktop Connection VNC to Raspberry Pi with RealVNC

In this post we will see how to control a Raspberry Pi remotely through a VNC remote desktop connection with the help of RealVNC.

As we mentioned when we saw the post about SSH on many occasions we will not have our Raspberry connected to a monitor and a keyboard, it will be used for tasks such as media center, web server, or home and robotics automation.

In these cases, we need a way to remotely control our device. In the previous entry of the Raspberry Pi tutorials we saw how to connect via SSH. In this post we will see another common way, a VNC remote desktop connection.

Unlike SSH, which only opened a command console, with VNC we can have a complete remote desktop. That is, on the client’s screen we will see the Raspberry Pi screen, we will move the mouse, and use it almost as if we were connected physically.

Despite its simplicity and convenience, a remote desktop also has its disadvantages. The main one is that it needs to transmit a large amount of data, mainly due to the need to send the video signal. Although modern systems use video compression, the behavior is slower than with a physical connection or an SSH connection.

Other disadvantages of the remote desktop, together with having to send the video connection, are, for example, that we may have some resolution problem, or not being able to view certain elements that are launched directly on the server’s GPU (such as some video players, webcams, or streaming videos).

Finally, VNC is less secure than SSH, so communication is more susceptible to interception by an attacker. Although it is possible to tunnel the VNC connection in an SSH and some clients incorporate encryption in the communication, keep in mind that it is safer to access via SSH.

What is VNC?

Virtual Network Computing (Virtual Network Computing) is a remote communication system based on the RFB (Remote FrameBuffer) protocol. VNC transmits the video signal and mouse and keyboard events between several computers.

VNC and RFP were originally developed by the Olivetti & Oracle Research Lab in Cambridge. They were created as a simple way to perform remote desktop between devices with different operating systems. In 2002 they discontinued the project and part of the team continued it independently forming the company RealVNC.

The VNC system follows a server and client architecture. By default it works over TCP on port 5900 and beyond, at the rate of one port for each video session. Therefore, port 5900 is assigned to session :0 (usually the physical display), 5901 to session :1, and so on.

There are currently more remote desktop systems, similar or even evolved from VNC. There are also different software compatible with VNC such as RealVNC, TightVNC, UltraVNC, X11vnc, among others, each has its fans and detractors.

In this post we will focus on RealVNC, as it is one of the most recommended for new users and, in addition, because in a way they are the “successors” of those who created VNC, and they deserve that we dedicate the first post of VNC to them. In future posts we will see other clients and alternatives.

Configure VNC on Raspberry

The computer to which we are going to connect, in this case our Raspberry Pi, must have the RNC server program installed. In modern distributions of Raspbian VNC comes preinstalled but not activated by default.

To activate the VNC server on the Raspberry Pi, we must go to the Raspberry Pi settings and activate the corresponding option as we saw in the post How to configure Raspberry Pi with GUI or command line.

On the other hand, it is convenient to have a static IP configured, so that it does not change every time we restart the Raspberry Pi. We saw how to configure a static IP in the post Configure Static IP on Raspberry Pi.

The VNC configured, in principle, will only work on the local network. If you want to connect from outside (over the Internet) you will need to configure a port mapping on the router and make sure the connection is secure.

If we are running an operating system that does not have VNC server installed, we can install it by running these commands.

sudo apt-get update
sudo apt-get install realvnc-vnc-server realvnc-vnc-viewer

Configure the client

To connect to the Raspberry Pi we must install the viewer program on the client, which can be a computer, a tablet, a mobile phone (and of course another Raspberry Pi). We have clients available for Windows, Linux, Mac, and Android.

As we said, in this post we will focus on RealVNC. We download and install the RealVNC viewer suitable for our operating system from .


Alternatively, we can also use the extension for Chrome, which we can install from the Chrome store. Then we access it by entering this link in the browser chrome://apps/


Regardless of whether we use one program or another (each with its own interface) the process to connect is similar. First, we configure a remote computer indicating the IP of the system to which we want to connect. This configuration is saved so that it is convenient to connect to our machines.


When starting the connection, we will be asked for the username and password. Remember that by default it is ‘pi’ as the username and ‘raspberry’ as the password.


It is a serious risk to expose a Raspberry Pi to the Internet with VNC enabled and the default user.

It is possible that the first time we connect with a VNC we get a message saying that the device’s signature is not known. It’s okay, it’s a security measure to prevent impersonation. If it’s the first time we connect, we simply accept to continue.


If the connection has been successful we will see the video of the Raspberry Pi on the screen of our computer and we will be able to interact with it almost as if we had the monitor and keyboard connected directly.


Congratulations! That’s how easy you have set up the remote desktop with RealVNC. In the next post of the Raspberry Pi tutorials we will see how to perform a completely headless configuration (without a monitor or keyboard) from scratch, without having to connect any peripherals.