It is not obvious to connect Raspberry Pi with keyboard, mouse, and monitor all the time. Most users just don’t want to burn their pocket by buying a dedicated monitor, mouse, and a 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 five such 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 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; this address is dynamic. The router assigns a new address once after 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 with 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:
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 to 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 shone here. And, go to interfaces tab there 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 login. We recommend to check 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 initiate 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.
xrdp:
Options don’t end working with CLI. Most users want to use the GUI desktop over the network. Good news is that it is as simple as to access the GUI desktop as CLI. There is a simple solution for this, XRDP. It is an open-source remote desktop protocol which allows you to connect remote desktop from any platform. This is a cross-platform protocol works on 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 a SSH session to the Raspberry Pi CLI.
Time needed: 5 minutes.
To setup XRDP on Raspverry Pi. Open the terminal if you have direct access. Or, take a 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 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 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 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 which can be used on most of the operating systems. There is a verity of products available on the market. Few products are free and few are commercial. But, most of the new Raspberry Pi distributions comes 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.
Open VPN:
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 setup. If your router provides VPN services on its own than you might consider that option. If you don’t have that option available on your router, then open 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 setup 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 favourite tools are chrome desktop. I love this because of its simplicity and light weight nature. All you need to have is a chrome browser with 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.
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/269915.html