FRP内网穿透工具

一、服务端安装:
1、下载frp最新版,最新版地址:https://github.com/fatedier/frp/releases,64位linux选择linux_amd64
wget https://github.com/fatedier/frp/releases/download/v0.48.0/frp_0.48.0_linux_amd64.tar.gz
2、解压缩
tar -xzvf frp_0.48.0_linux_amd64.tar.gz
3、重命名
mv frp_0.48.0_linux_amd64 frp048
4、编辑服务端配置
使用vim命令进入编辑模式,输入i后可以进行修改,修改完成后输入ESC,再输入:wq 退出编辑模式。
vim frps.ini[common]
bind_port = 7000 #通信接口
bind_udp_port = 7001 #服务端监听接口
kcp_bind_port = 7000
vhost_http_port = 80
vhost_https_port = 443
dashboard_addr = 0.0.0.0
dashboard_port = 7500 #dashbord端口
dashboard_user = admin #dashbord用户名
dashboard_pwd = admin #dashbord密码
log_file = ./frps.log
log_level = info
log_max_days = 5
max_pool_count = 5
max_ports_per_client = 0
tcp_mux = true
token = password #通讯密钥

5、使用systemctl来控制启动,编辑 frps.service
sudo vim /lib/systemd/system/frps.service
[Unit]
Description=frps service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
#Restart=always
Restart=on-failure
RestartSec=5s
#启动服务的命令(此处写你的frps的实际安装目录)
ExecStart=/root/frp048/frps -c /root/frp048/frps.ini
[Install]
WantedBy=multi-user.target

6、服务命令
# 设置开机自启动
sudo systemctl enable frps
# 启动应用
sudo systemctl start frps
# 重启应用
sudo systemctl restart frps
# 停止应用
sudo systemctl stop frps
# 查看应用的日志
sudo systemctl status frps

二、群晖安装(docker):
1、下载映像
拉取snowdreamtech/frpc
2、安装容器
选择host网络,选择“使用高权限执行容器”,选择“启用自动重新启动”;选择文件映射:本地frpc.ini的位置 → /etc/frp/frps.ini
3、编辑客户端配置
[tcp] #群晖系统的TCP协议
type = tcp #传输协议
local_ip = xxx.xxx.xxx.xxx #内网地址
local_port = 9837 #群晖使用的端口(非https)
remote_port = 60001
[http] #群晖系统的https协议
type = http
local_ip = xxx.xxx.xxx.xxx
local_port = 80
use_compression = true
custom_domains = domain.com
[https] #群晖系统带https协议
type = https
local_ip = xxx.xxx.xxx.xxx
local_port = 443
use_compression = true
custom_domains = domain.com
[qb]
type = http
local_ip = xxx.xxx.xxx.xxx #内网地址
local_port = 4356 #内网端口,用于区分不同带服务,比如qb、jellyfin等
custom_domains = qb.domain.com #域名或二级域名

三、域名解析
需要将你想使用的域名解析到服务端的公网ip

四、相关链接
github地址:https://github.com/fatedier/frp
dockerhub地址:https://registry.hub.docker.com/r/snowdreamtech/frpc/
中文文档:https://gofrp.org/

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注