­

树莓派FRP内网穿透及自启动

内网穿透的步骤和文件存档

实验室在远方部署了电脑主机来采集数据和图片,每次去调试会很麻烦,因而使用FRP内网穿透使得我们可以在实验室访问主机。

主要功能

实现远程可访问和开机自启FRP程序服务

安装和下载FRP

服务器端:

wget //github.com/fatedier/frp/releases/download/v0.33.0/frp_0.33.0_linux_amd64.tar.gz
tar zxvf frp_0.33.0_linux_amd64.tar.gz
cd frp_0.33.0_linux_amd64/

配置:

[common]
bind_port = 7000

启动服务:
./frps -c ./frps.ini

客户端:

[common]
server_addr = 127.0.0.1
server_port = 7000

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

这里注意,多客户端配置时[ssh]里面的内容是配置组名,需要和其他SSH区别开

开机启动

//github.com/fatedier/frp/issues/176
vi /etc/systemd/system/frps.service 新建此文件,并写入以下内容:

[Unit]
Description=frps daemon

[Service]
Type=simple
ExecStart=/usr/bin/frps -c /etc/frps/frps.ini

[Install]
WantedBy=multi-user.target

启动并设为开机自启。
$ systemctl start frps
$ systemctl enable frps