內網穿透的步驟和檔案存檔

實驗室在遠方部署了電腦主機來採集資料和圖片,每次去除錯會很麻煩,因而使用FRP內網穿透使得我們可以在實驗室訪問主機。

主要功能

實現遠端可訪問和開機自啟FRP程式服務

安裝和下載FRP

伺服器端:

wget https://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區別開

開機啟動

https://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