It is not obvious to connect Raspberry Pi with a keyboard, mouse, and monitor all the time. Most users just don’t want to burn their pocket by buying a dedicated monitor, mouse, and keyboard for their Raspberry Pi. For all of them, connecting Pi on remote is the best-suited alternative. We want to tell you the five best possible ways to connect Raspberry Pi remotely. If you want to know, then you are in the right place.
This article shows the five easiest ways to connect Raspberry Pi remotely.
If you are using Raspberry Pi for the first time, please read this first: How to set up a Raspberry Pi for the first time?
Static IP address: Before directly going to learn how to connect Raspberry Pi remotely. It is much needed to configure a static IP address to the Pi. There are two ways to configure a static IP address to the Pi.
1. Assigning a Static Dhcp Lease on the Router:
I believe you are aware of the DHCP service. This service is developed to assign IP addresses to the devices connected to the network. Ideally, this service is managed by your home router. When you connect your Pi to your router either over Ethernet or WiFi, your router assigns an IP address to your Pi. Bear in mind; that this address is dynamic. The router assigns a new address once after the lease period elapsed. This nature of DHCP may force you to set up a remote connection each time your Pi gets a new address. And, you may lose control over your Pi if you are outdoors. This may create a hassle for you. To avoid this mess, it is better to configure Pi with a static IP address to make your settings more stable.
To assign a static lease to Pi, note down the mac address of the network interface of the Pi using ‘ifconfig’ command. And make an entry on the router and map the mac address of Pi to an IP address. This configuration allows the router to never expire the lease and keep the IP static. We didn’t cover how to make this change on the router as the steps may differ on each router module. Please go through your router’s user manual to set the configurations on your router.
2. Assign a Static Ip Address on the Raspberry Pi:
This option is quite easy too. You may need to manually track to avoid accidentally assigning the same IP address to more than one device on the network. Follow these steps to configure a static IP address on the Raspberry Pi.
- Hit a WiFi symbol or LAN symbol and select network settings on the drop-down menu.
2. Enter the IP address, Router, and DNS server’s IP address and hit apply and close.
3. Reboot the Pi So That All Changes Can Take Effect
All right, now we are set to go. There are several ways to connect Pi remotely. We are going to tell you the five most commonly used methods in this article.
SSH is the most prevalent method to connect Raspberry Pi remotely. We don’t think there is someone who didn’t use this remote terminal protocol at any point in a lifetime. It’s the most common way of login into any non-windows platform. The only limitations are that you should have access to the network to which the Pi is connected, and this gives access to the only command-line interface. Let’s see how to connect to Pi using SSH.
1. Make sure SSH is enabled on the Pi. to ensure that, go to main menu -> preferences -> Raspberry Pi configuration as shown here. And go to the interfaces tab where you can enable the SSH and hit OK.
2. Connecting from Linux: There is nothing additionally required from a Linux to connect. Up to my knowledge, a command-line SSH client is loaded with all Linux distributions. SSH command format to connect remote server is: ssh [email protected]/IP address. If taking Raspberry Pi as an example. ssh [email protected]. SSH supports plenty of different options to log in. We recommend checking out the SSH protocol for more information.
3. Connecting from Windows: To connect from Windows, you should require an SSH client program like Putty. Install and run the Putty. Supply the hostname or IP address of the Pi with 22 in the port number field. This initiates an SSH session with the Raspberry Pi. This session asks you to enter the username and password. After a successful login, it gives you a command-line prompt. Simple, isn’t it?
Options don’t end working with CLI. Most users want to use the GUI desktop over the network. The good news is that it is as simple as accessing the GUI desktop as CLI. There is a simple solution for this, XRDP. It is an open-source remote desktop protocol that allows you to connect remote desktops from any platform. This is a cross-platform protocol that works on a 3389 standard port. Just you need to allow this port on the system firewall. One downside is it can be used only inside the network. You need to install the XRDP and tight VNC server to take RDP sessions from the RDP client.
Open the terminal if you have direct access. Or, take an SSH session to the Raspberry Pi CLI.
Time needed: 5 minutes.
To set up XRDP on Raspberry Pi. Open the terminal if you have direct access. Or, take an SSH session to the Raspberry Pi CLI.
- Update the system repositories:
$ sudo apt-get update && apt-get upgrade
- Install the XRDP package:
$ sudo apt-get install xrdp -y
- Install tight VNC server:
$ sudo apt-get install tightvncserver -y
It takes a few minutes to install the packages.
- start the XRDP service by using the command:
$ sudo systemctl start xrdp
- To start XRDP service at boot, use the enable command:
$ sudo systemctl enable xrdp
- To conform XRDP listening on 3389 port with netstat command:
$ sudo netstat -tulpn | grep xrdpOutput:tcp 0 0 127.0.0.1:3350 0.0.0.0:* LISTEN 7534/xrdp-sesmantcp 0 0 0.0.0.0:3389 0.0.0.0:* LISTEN 7535/xrdp
Connecting from Linux client: Remmina, one such RDP client application is the best option to initiate an RDP connection to Pi. You can install the application by issuing the below command. It may take a couple of minutes, depending on your system and internet speed. It works only on the GUI desktop environment. This is a very cool application. It can work as RDP, SSH, and VNC client.
$ sudo apt-get install remmina, remmina-common, remmina-plugin-rdp
Connecting from Windows client: No additional programs are required to connect Raspberry Pi from a Windows computer. Windows has a built-in program called ‘Remote Desktop connection’.
- Open the Run window by hitting ‘Windows Key’ + ‘R’ at the same time.
2. Type the Raspberry Pi’s IP address and optionally provide the login credentials too. Credentials could be supplied later as well. At last, hit ‘Connect’
Virtual Network Computing:
This is the obvious option when you work with Linux platforms. In short, it’s called VNC. It’s a cross-platform remote desktop technology that can be used on most operating systems. There is a variety of products available on the market. Few products are free, and few are commercial. But, most of the new Raspberry Pi distributions come with ReavVNC, which supports cloud-based connections right in. This allows you to connect Pi not only within the network but also over the internet. RealVNC gives users the freedom to connect from anywhere. This flexibility makes this option more prominent than others. To keep this post simple, we have created another dedicated blog post to show you how to set up the VNC on the Raspberry Pi. Please visit the post “How to setup Open VNC on Raspberry Pi” and leave your comments.
The last piece of our remote connectivity puzzle is how to access our Pi when you are out of your home. I thought it’s better to share this because it’s free and easy to set up. If your router provides VPN services on its own, then you might consider that option. If you don’t have that option available on your router, then opening a VPN is a good alternative you might consider. To shorten this post, we have created another dedicated blog post to show you how to set up the Open VPN on the Raspberry Pi. Please read the post “How to set up Open VPN on Raspberry Pi” and leave your comments.
Use Third Party Products:
This is the simplest way to connect Raspberry Pi. There are a wide set of tools available in the market to connect Pi remotely. We recommend not to leave this option unchecked. My favorite tools are chrome desktop. I love this because of its simplicity and lightweight nature. All you need to have is a chrome browser signed into it. The procedure is as simple as a couple of clicks.
- Open Chrome browser on the Pi and visit https://remotedesktop.google.com/
- Select Remote Access and download & install the application. That’s all.
- To access the Pi over the internet, launch the chrome browser on the machine from where you want to access your Pi and visit the same page and select Remote Access. There you are going to see your Pi as an icon. Click to connect.
Thank you for reading this article. Please visit the below links to read more such interesting articles. Peace leaves your comments here below and let us know your feedback. This helps us to bring more such articles.