跳至主要內容

内网穿透折腾记录

Northword小于 1 分钟

内网穿透折腾记录

通过 frp

配置参考

参考 | frp (gofrp.org)open in new window

frps.ini

[common]
bind_port = 7000
token = 通讯密码
subdomin_host = frp.northword.cn
log_file = ./frps.log
log_level       = info
log_max_days    = 5

frpc.ini

[common]
server_addr = frp.northword.cn
server_port = 7000
log_file = /home/scujh_zjb/apps/frp/frpc.log
log_level = info
log_max_days = 3
token = 通讯密码

[HPC-Inelt]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6001

linux 端 systemctl 配置

frp 包中提供了 systemctl 的配置文件模板,服务端和客户端各两个,带 @ 的可以传参以启动多个实例。将模板复制到 systemctl 服务配置路径:/lib/systemd/system/

[Unit]
Description=Frp Client Service
After=network.target

[Service]
Type=simple
Restart=on-failure
RestartSec=5s
ExecStart=/home/scujh_zjb/apps/frp/frpc -c /home/scujh_zjb/apps/frp/frpc.ini
ExecReload=/home/scujh_zjb/apps/frp/frpc reload -c /home/scujh_zjb/apps/frp/frpc.ini
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target

初次配置后需要重载服务,之后启动无须此步:

systemctl daemon-reload

然后启动服务::

#启动 
sudo systemctl start frpc 
#关闭 
sudo systemctl stop frpc 
#重启 
sudo systemctl restart frpc 
#查看状态 
sudo systemctl status frpc

启用开机自启:

sudo systemctl enable frpc

启动成功示意: