Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up remote access in raspberry pie

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you about how to set up remote access in raspberry pie. The article is rich and analyzed and described from a professional point of view. I hope you can get something after reading this article.

Disable automatic login

Raspberry pie starts by default and goes directly to the desktop without the need for users to log in. Although raspberry pie is often placed on the intranet, it is still not safe. In order to improve security and privacy protection, it is recommended to disable the automatic login feature. The operation mode is as follows:

Enter sudo raspi-config in the window to enter the command line interface

raspi-config界面

Select "boot options" through the up and down arrows, and then select "desktop/cli". If you have installed a desktop system, select "desktop", otherwise select "console", and then enter

The interface goes back to the initial selection interface, press the "tab" key to jump the cursor to "finish" and press enter. The program will ask you if you want to restart and choose "yes" or "no" according to your needs.

Raspi-config is the raspberry pie system comes with the system configuration tool, easy to use and powerful, nothing to suggest to go in and have a look.

Set static ip

Raspberry pie is mainly used as a server at home, and ip should not be changed frequently. There are three ways to fix a raspberry pie ip:

Bind ip and mac addresses through the router. This requires logging into the web management interface of the router, which varies according to the model

In the graphic desktop, right-click the network icon in the upper right corner, select "wirelesss&wired network setting", select "interface" in the settings window that appears, and set the ip address, subnet mask, dns and so on of the wired network card (eth0) and wireless network card (wlan0) respectively:

树莓派网络设置

Edit the * * / etc/dhcpcd.conf** file manually and add something like the following line at the end of the file:

Interface eth0inform 192.168.1.2static routers=192.168.1.1static domain_name_servers=114.114.114.114static ip6_address=2409:8a00:78d8:10b0:9d9e:1193:c495:228f

Remote access Settings

After completing the basic settings, let's officially enter the settings for remote access.

Turn on ssh

Ssh is one of the most essential and important services on almost all servers, but raspberry pie is turned off by default, so turn it on first. There are three ways to turn on ssh service on raspberry pie:

Enter: sudo systemctl enble sshd & & sudo systemclt start sshd on the command line

Using the raspi-config command, select "ssh" in "intefacing options" and set it to on

In the graphics desktop, click logo in the upper left corner of the raspberry pie, select "preferences"-> "raspberry pi configuration" from the menu, select "interfaces"-> "ssh" in the pop-up window, and click OK.

树莓派开启ssh访问

After setting up, use putty and other terminals to connect raspberry pie. Successful connection means that there is no problem with the setting.

Intranet penetration

For people who deploy nas or place servers at home, intranet penetration is a topic that must be mastered and cannot be avoided. Network penetration includes fee-based penetration software such as sunflowers and peanut shells, remote control software such as teamviewer, and open source software such as frp. In this paper, the vps with public network ip is used as the private network penetration server, and the open source frp is used as the private network penetration solution. The setting steps are as follows:

Deploy the server. Download the software version of the corresponding server system on the frp official website and decompress it with the tar-zxvf frp_0.29.0_linux_xxxx.tar.gz command. Then go to the frp software directory and edit frps.ini. A simple authorized configuration is: [common] bind_port = your port number token= authentication key then start the frps service: nohup. / frps-c frps.ini > > frps.log 2 > & 1 &. If you have a firewall on, remember to release the appropriate port.

Raspberries are sent to deploy the client. Although the raspberry pie 4B uses a 64-bit processor, the raspbian system is 32-bit, so remember to choose the "frp_0.29.0_linux_arm.tar.gz" version when downloading from the frp website. After decompressing, enter the frp directory and edit frpc.ini. A configuration that enables ssh interpenetrating access is:

[common] server_addr = server ipserver_port = server port token = server key [ssh] type = tcplocal_ip = 127.0.0.1local_port = 22remote_port = port you want to listen on the server

After configuration, start the frp client: nohup. / frpc-c frpc.ini > > frpc.log 2 > & 1 &.

If there is no problem with the configuration, ssh can be connected to the raspberry pie through the public network ip listening port.

Ssh tunneling is a very powerful function, which is described in detail in [three ways of ssh port forwarding]. In practice, it is strongly recommended that intranet traversal only open the ssh port, and the remote access of other software is connected through ssh tunnel, which is safe and convenient.

Vnc remote access

For desktop systems, it is best to be able to view the desktop remotely. Generally speaking, there are two solutions: rdp for windows remote Desktop, and vnc for open source. For a linux player, vnc is undoubtedly a better choice. Next, we briefly explain the configuration process of vnc.

For raspberry pie connected to the monitor, vncserviced is recommended. The three enabling methods are the same as ssh, and the command line command is: sudo systemctl enable vncserver-x11-serviced & & sudo systemctl start vncserver-x11-serviced. Realvnc server for raspberry pie, you need to download realvnc client to connect

Once set up, remove the raspberry pie from the mouse and keyboard monitor (in headless "headless" mode), and the vnc server needs a virtual desktop. The mode of operation is: enter the vncserver,vnc server to create a virtual desktop. Then connect through the realvnc client. The default port is 5901 (which can be viewed via netstat-nlpt | grep-I vnc)

In practice, it is not recommended to do private network traversal of vnc connections through frp. Choose ssh port forwarding as far as possible to encrypt connection traffic.

At this point, we have set up the perfect raspberry pie remote access solution, both command-line ssh and vnc to view remote desktops.

This is how to set up remote access in the raspberry pie shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report