Intranet penetration using Frp

I've been tossing about the remote control of the computer these days, because I'm always afraid of something unexpected in the unit, and then I don't have an environment on my computer. Then I think I can directly power on the motherboard by remote control and start it directly and remotely.

It's easy to power on the motherboard and start it directly. It's in the motherboard settings. Set a power on automatic power on, and then buy a smart socket.

However, I found a problem. When you start up, you start up, but remote software such as sunflower needs to start the service when the user logs in.

My computer has a password, and I don't want to cancel it. How can I fix it.

After thinking for a while, I felt that Microsoft's own mstsc might be OK, but the unit's personal work computer does not have a public network ip, so the external network remote connection is not sent?

Well, get an intranet penetration.

It was the coldest day of the night when I was injured. I was haggard and could not bear pity. I invited wine to destroy my intestines and drank three cups of wine. I found fragrance and startled my dream. It was colder in the fifth day of the year. The hairpin head and Phoenix had tears. I had no chance to spend tea. The small building was lonely and the new rain moon was also difficult to hook and round

A final poem.

Can my code sell you a set poem?

Let's not talk more nonsense - there's a lot of nonsense. Let's go straight to the correct text.

Note in advance: understand Linux daemons, and you don't need to jump to three

1, NodeJS

Why write node JS when writing Frp?

Because frp is a foreground application when running on linux. As soon as you open the bash of this application and exit, hey, it's gone ~ so I mainly want to make pm2 as the daemon of frp and start frp as a nohup application to prevent myself from exiting.

Take CentOS 7 as an example:

Let's first make sure we have a C + + compiler, and then we'll compile the source code:

yum -y install gcc gcc-c++ kernel-devel

(I use version 8.11.3, and the current lts version is 16.13.2. To install, I need to upgrade GCC. The upgrade is too cumbersome. I'm too lazy to upgrade. Anyway, I use an npm. If you upgrade GCC to install a new version, you can see this: https://blog.csdn.net/w345731923/article/details/107204098 )

Then download the source code compressed package of NodeJS:

wget https://nodejs.org/dist/v8.11.3/node-v8.11.3.tar.gz

After downloading, let's decompress it directly:

tar -xzf node-v8.11.3.tar.gz

Then delete the compressed package (or not), enter the newly unzipped folder, and compile it:

#Delete the current compressed package
rm node-v8.11.3.tar.gz
#Enter the newly extracted folder
cd node-v8.11.3
#compile
./configure
make

This step takes a long time. We can change the water for the fish tank, take a bath for the cat, and then pull our hands out of the turtle's mouth

It's not easy to pull out your fingers. Let's stick a band aid and come back to have a look. It's almost finished.

Continue to use the compiled file for installation (this is fast):

make install

Try to see if the current installation is successful:

npm -v
#5.6.0

Oh, nice.

2, Install pm2

Let's just say that after npm, it will take minutes to install pm2:

npm install pm2 -g

Then, you can set pm2 to startup, but you can set it or not. It depends on the individual:

#Set startup
pm2 startup
#Cancel startup
pm2 unstartup

How to open an application using pm2:

#Start application
pm2 start "Start command" --name Set application name
#Save current app list
pm2 save
#View application log
pm2 log

3, Frp

With so much nonsense, I finally got to the point

We can go first https://github.com/fatedier/frp/releases Look at the current version

In addition, the configurations of Linux and windows are almost the same (in fact, there is no difference = - =), so I said in the way I did before, server linux and client windows (who still remembers why I did this thing)

linux download:

  wget https://github.com/fatedier/frp/releases/download/v0.38.0/frp_0.38.0_linux_amd64.tar.gz

After the download is completed, it is still decompressed:

tar -xzf frp_0.38.0_linux_amd64.tar.gz
mv frp_0.38.0_linux_amd64.tar.gz

We use the server side, so adjust FRPs ini:

cd frp_0.38.0_linux_amd64
vim frps.ini

Here are the parameters:

[common]
#Server port
bind_port = <port>
#ipv4 filtering
bind_addr = <Permitted ipv4 Address, do not intercept, default 0.0.0.0>

#Client connection authentication method
authentication_method = token
token = <You set it yourself token>

#Web console related
dashboard_port = <console port >
dashboard_user = <Console login user name>
dashboard_pwd = <Console login password>

In addition, because these things are stored in plaintext on the server, I suggest that passwords and token s should not be used in common use on other platforms or through some encryption algorithms

Then start, and the settings on the server side are OK!

Remember to open the firewall!!!

#Simply open
./frps -c ./frps.ini
#Use pm2
pm2 start "./frps -c ./frps.ini" --name FrpServer

The client side is almost the same. Go https://github.com/fatedier/frp/releases Download frp_0.38.0_windows_amd64.zip. After downloading, unzip it and open FRPC. Zip in the folder ini

[common]
server_addr = <Server public network ip>
server_port = <Server port>
authentication_method = token
token = <Just set up on the server token>

[RDP]
#For example, I get a remote, so local_port is 3389
#type, http, udp, https and so on
type = tcp
local_ip = 127.0.0.1
local_port = <Local port to be mapped>
remote_port = <Mapped port of the server>

If started, open cmd in the current folder and enter:

frpc -c frpc.ini

Then, my words are directly thrown into the planned task. If you don't know where it is, you can press win+r to open the run input:

%windir%\System32\compmgmt.msc

Then find the computer management - > system tools - > Task Scheduler - > Task Scheduler Library on the left:

 

Click create task on the right:

In the General tab, select "run regardless of whether the user logs in" and check "run with highest permission";

Create a new trigger in the trigger tab, and select "on startup" in "start task" in the pop-up window;

In the new operation tab, select frpc.exe under the folder where frpc.ini is located in "program and script", add the parameter "enter - c frpc.ini", and start from the folder where frpc.ini is located in "enter

Just make sure!

 

Finally, restart the computer, enter < server public network ip: port number > > in the browser, and enter the dashboard account password just set on the server:

 

On the home page, you can see that ClientCounts and ProxyCounts are 1

I drop the task and finish the old!

 

 

Added by sumolotokai on Wed, 12 Jan 2022 08:04:55 +0200