Whether Sakura Frp Intranet penetration V2.0+ periodic query is enabled

Sakura Frp official website link

prefaceCentOS7

  • It can be said that it is a free remote connection tool, of course there are optional peanut shell (free version network speed 1M, there are traffic limits), I need the client boot can connect, upload and download speed some
  • It is difficult to obtain free traffic, so you need to log in and sign in every day to obtain 1-5GB of traffic, which is sufficient for remote use and temporary use for uploading and downloading
  • Officials say high-speed traffic is10Mbps upstream / 10Mbps downstreamBut I actually downloaded it750KBLeft and right, upload160-180KB Test at 10 PM, 4M/sNot quite, but a lot better than 1M (125KB) broadband on cloud servers
  • When the data is gone, it’s down to 4Mbps, not out of service
  • Personal EnvironmentCentOS7, there is no good introduction to other environments, see the official website tutorial

Installation use – basic

/root create folder sakura and download it (Linux 64-bit select AMd64)

  • Do not use Sakurafrp in the folder name, because sakurafRP will be used to configure automatic startup and periodic query later. The script may obtain the periodic query process in this folder
  • – no – check – certificate meansUnsafe connection, use "Do not check certificates"I don’t have to add it now
mkdir sakura 
cd sakura
wget https://qianqu.me/frp/frpc_linux_amd64 --no-check-certificate
Copy the code

2. Click Create Tunnel on the management panel, I select Zaozhuang Multi-line 1 and configure the Intranet mapping port 22, select the external network port from 10240-65535, and click create. 3

chmod +x frpc_linux_amd64
./frpc_linux_amd64
Prompt for the access key, please enter the management panel, copy the key in the user informationThe system prompts you to select a tunnel. For example, to create a tunnel, select Zaozhuang Multi-line 1 for the Frp server. Then, enter 3After the message is displayed, use the IP address and port number to connectCopy the code

Installation use – Advanced

1, Management panel click configuration file, server select Zaozhuang Multi line 1, copy the configuration to Sakura /sakurafrp.ini, then run the following command to start

/root/sakura/frpc_linux_amd64 -c /root/sakura/sakurafrp.ini
Copy the code

2, configuring startup vim/lib/systemd/system/sakurafrp. Service

[Unit] 
Description=fraps service
After=network.target syslog.target 
Wants=network.target
[Service] 
Type=simple ExecStart=/root/sakura/frpc_linux_amd64 -c /root/sakura/sakurafrp.ini [Install] WantedBy=multi-user.target Copy the code
systemctl start sakurafrp   # start sakurafrp
systemctl stop sakurafrp   Close # sakurafrp
systemctl enable sakurafrp   # SakurafRP starts automatically upon startup
systemctl disable sakurafrp  # Stop startup SakurafRP
systemctl restart sakurafrp  # Restart SakurafRP
Copy the code

3. Create a script to determine whether SakurafRP starts vim Sakura.sh

  • It is best not to use Sakurafrp for naming, otherwise script queries may be inaccurate
#! /bin/sh
RUNNING=`ps -x | grep sakurafrp | grep -v grep`
curtime=`date "+%F %H:%M:%S"`
if [ "$RUNNING" ]; then
## echo $curtime 'test runing' $RUNNING >> /root/sakura/sakura.log exit else echo $curtime "test starting" >> /root/sakura/sakura.log systemctl start sakurafrp fi Copy the code
Chmod +x./sakura.shCopy the code

4, after the above execution is correct, add it to the timing program

  • 5 minutes Run the frpdog.sh script vi /etc/crontab
    */5 * * * *  /root/frp/frpdog.sh
    Copy the code
  • Save the effect
Crontab /etc/crontab // Loads the task for it to take effectCrontab -l // View tasksCopy the code

This article is formatted using MDNICE