Raspberry Pi uses FRP to achieve intranet penetration tutorial

1. What is intranet penetration?

Simply put, a computer in the intranet has its own internal IP, and a computer on the external network has a public IP, and the internal IP cannot be directly accessed through the external network. This requires a way to change the external IP Converted into internal legal IP for legal access.

2. What is FRP?

frp is a high-performance reverse proxy application that can be used for intranet penetration, supporting tcp, udp, http, https protocols.

3. Preparation materials:

服务端:虚拟专用服务器 
客户端:树莓派3B/3B+/4B

Fourth, prepare a virtual private server

1. What is a virtual private server?

Virtual Private Server Virtual private service technology, a high-quality service that divides a server into multiple virtual private servers. The technology for realizing virtual private server is divided into container technology and virtualization technology . In a container or virtual machine, each virtual private server can be assigned an independent public network IP address, an independent operating system, and realize the isolation of disk space, memory, CPU resources, processes, and system configuration among different virtual private servers for users and applications The program simulates the "exclusive" use of computing resources. The virtual private server can be like an independent server, reinstall the operating system, install the program, and restart the server separately. Virtual dedicated server provides users with the freedom of management configuration, which can be used for enterprise virtualization or IDC resource leasing.
The public network server forms a bridge with FRP. Through it, we can access the Raspberry Pi that we placed on the internal network.
Insert picture description here

2. Virtual private server of virmach used

VirMach is a very cheap US host that supports Linux virtual private servers and Windows virtual private servers.
Buy the link (you can also choose other homes)

https://billing.virmach.com/cart.php

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
After
you buy it, you will receive 3 emails

Insert picture description here

The top email contains your IP and account password
Insert picture description here

Click on My Services
Insert picture description here
and then click the button below
Insert picture description here

Enter the server background
Insert picture description here

Open PUTTY and enter your ip (you can get the software by sending putty to the official account)
Insert picture description here

Enter the account root and the initial password (in the email)
Insert picture description here
Insert picture description here

Log in to the server terminal for the first time
Modify the login password
Enter directly

passwd 

Enter twice, and the new password is enough.

Insert picture description here

Five, server side-virtual private server configuration

Use FXP (you can get the software by sending "fxp" to the official account") to upload the downloaded frp installation package to the server (you can get it by sending "frp" to the official account.

If your virtual private server is different from this tutorial, you can choose the FRP suitable for your virtual private server at the following URL

https://github.com/fatedier/frp/releases

Log in to FXP with your server IP and the password you just changed
Insert picture description here

tar -zxvf frp_0.20.0_linux_386.tar.gz

After the file is decompressed, it usually contains frps (frp server running file), frpc (frp client running file), frps.ini (frp server configuration file), frpc.ini (frp client configuration file), and frp_full. ini (Explanation and reference of all FRP configuration files.)

Enter the following command in the server terminal

cd frp_0.20.0_linux_386

nano frps.ini

Enter in frps.ini:

[common]

bind_port = 7000

dashboard_port = 7500

dashboard_user = dashboard_user_name

dashboard_pwd = dashboard_pwd_value

The [common] part is a required configuration.
The bind_port is the port of the frp server you set. The
dashboard_port_number is changed to a specific port number, such as 8000, so that you can access the frps web console through http://yourip:8000 page.
dashboard_user and dashboard_pwd to fill in the username and password for a custom for input when accessing frps console page.
img

After saving the above configuration, use the following command to start the frp server.

./frps -c ./frps.ini

Insert picture description here
Enter "IP:7500" in the browser to see the background of your FRP
Insert picture description here

6. Client-Raspberry Pi configuration

Raspberry Pi normally logs in to putty, enter the following command

wget https://github.com/fatedier/frp/releases/download/v0.20.0/frp_0.20.0_linux_arm.tar.gz

tar -zxvf frp_0.20.0_linux_arm.tar.gz

cd frp_0.20.0_linux_arm

sudo nano frpc.ini

Write the following

[common]

server_addr = 填写你的服务器ip

server_port = 7000


[VNC]

type = tcp

local_ip = 127.0.0.1

local_port = 5900

remote_port = 5900

note

Here is an example with VNC, you can also do domain name mapping

img
Enter the following command to run

./frpc -c ./frpc.ini

Insert picture description here

success

We started to use VNC to test whether it was successful

You can use the VNC of your mobile phone or the VNC of your computer for login test (do not connect to the same network as the Raspberry Pi)
Insert picture description here
Insert picture description here

You can also take a look at the port situation in our FRP background
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41676577/article/details/112856618