Use Frp for reverse proxy to realize remote desktop control [teamviewer/nomachine]

.Use Frp for reverse proxy to realize remote desktop control

V1.0.0 – by Holden

Date : 2023-06-20

1 Introduction

​ frp is a high-performance reverse proxy that can be used for intranet penetration, supports tcp, udp protocols, provides additional capabilities for http and https application protocols, and tentatively supports point-to-point penetration.

​ At present, because teamviewer is often considered to be engaged in commercial activities, there is a problem of prohibiting its use;

​TeamViewer has a function that allows Lan direct connection , that is to say, it allows use within the LAN without going through the TeamViewer server. This provides us with an idea and found a reverse proxy tool that can realize port forwarding for remote desktop connections.

​ As shown in the figure below, it is divided into server side, control machine side and controlled side .

insert image description here

2. Tool preparation

​ Download the corresponding installation file on the https://github.com/fatedier/frp/releases page, and select the corresponding file version according to your server system type;

​ If the client system is windows or other systems, you also need to download the installation file of the corresponding version.

insert image description here

​ After downloading, you can start the construction work.

3. Server-side construction

​ Take server X86_64-ubuntu as an example, download the corresponding frp_0.48.0_linux_amd64.tar.gz installation file and upload it to the server directory.

$ uname -a
Linux VM-12-4-ubuntu 5.15.0-48-generic #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

​ After decompressing the installation file, check frps.ini, the default configuration port is 7000.

$ tar -zxvf frp_0.48.0_linux_amd64.tar.gz
$ cd frp_0.48.0_linux_amd64
$ vim frps.ini
[common]
bind_port = 7000
$ ./frps -c ./frps.ini

​ The result of the operation is shown in the figure:

insert image description here

! ! ! Note: The server needs to open the corresponding port access! ! !

insert image description here

4. Controlled terminal configuration && run teamviewer

​ Take the controlled terminal as the ARM architecture ubuntu1804 as an example, download the corresponding frp_0.48.0_linux_arm64.tar.gz installation file and put it in the ARM architecture ubuntu1804 . After decompressing the installation file, after decompression, the configuration file: frpc.ini , add the following configuration:

[common]
server_addr = xxx.xxx.xxx.xxx 
server_port = 7000
 
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
 
[teamview]
type = tcp
local_ip = 127.0.0.1
local_port = 5938
remote_port = 5938

​ Assume that the server ip is xxx.xxx.xxx.xxx (need to be set to your own server IP address), and the default proxy port of teamviewer is 5938. After the configuration is complete, run the following command.

./frpc -c ./frpc.ini

​ Open the teamviewer client software, the basic operation is the same as when using teamviewer, you need to download the corresponding version: https://www.teamviewer.com/en-us/download/linux/

​Note that you need to allow direct LAN connection in teamviewer settings, and set the teamviewer remote password.

insert image description here

5. Run teamviewer on the controller

​ After the frp agent is configured on the controlled side, the teamviewer client on the control side only needs to change the usual input ID to input the IP address of the server .

6. Switch to nomachine

​ The principle is the same as teamviewer, you only need to add port 4000 of nomachine, and you need to change both tcp/udp.

​ Take the controlled terminal as the ARM architecture ubuntu1804 as an example, download the corresponding frp_0.48.0_linux_arm64.tar.gz installation file and put it in the ARM architecture ubuntu1804 . After decompressing the installation file, after decompression, the configuration file: frpc.ini , add the following configuration:

[common]
server_addr = xxx.xxx.xxx.xxx 
server_port = 7000
 
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
 
[teamview]
type = tcp
local_ip = 127.0.0.1
local_port = 5938
remote_port = 5938

[namachine_tcp]
type = tcp
local_ip = 127.0.0.1
local_port = 4000
remote_port = 4000

[namachine_udp]
type = udp
local_ip = 127.0.0.1
local_port = 4000
remote_port = 4000

​ Assume that the server ip is xxx.xxx.xxx.xxx (need to be set to your own server IP address), and the default proxy port of nomachine is 4000. After the configuration is complete, run the following command.

./frpc -c ./frpc.ini

​ Open the nomachine client software, the basic operation is the same as when using nomachine, you need to download the corresponding version: https://downloads.nomachine.com/

insert image description here

​Note that it needs to be running in the server.

insert image description here

​ This is the end.

Guess you like

Origin blog.csdn.net/m0_54792870/article/details/131311454