公网服务器
公网服务器frps.toml
bindPort = 81
# 127.0.0.1 Dashboard 端口,后面会进行内网穿透,因此不用配置ip为0.0.0.0
webServer.port = 82
auth.token = "token令牌"
公网服务器frpc.toml
# 因为是在公网服务器的frpc所以直接配127.0.0.1
serverAddr = "127.0.0.1"
serverPort = 81
auth.token = "token令牌"
loginFailExit = false
# Dashboard 被远程设置开始
[[proxies]]
name = "stcp_Dashboard"
type = "stcp"
secretKey = "uuid"
localPort = 82
transport.useCompression = true
[[proxies]]
name = "xtcp_Dashboard"
type = "xtcp"
secretKey = "uuid"
localPort = 82
transport.useCompression = true
启动frpc并设置开启自启动
sudo vi /lib/systemd/system/frpc.service
[Unit]
Description=frpc service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
#ExecStartf分别对应frpc的安装路径和配置文件路径
ExecStart=/data/frp/frpc -c /data/frp/frpc.toml
[Install]
WantedBy=multi-user.target
启动并设置开机启动
sudo systemctl start frpc && sudo systemctl enable frpc
内网机器【如:家用电脑】
frpc.toml
访问公网的Dashboard
serverAddr = "frps公网地址"
serverPort = 81
auth.token = "token令牌"
loginFailExit = false
#远程 frps Dashboard开始
[[visitors]]
name = "stcp_Dashboard_visitor"
type = "stcp"
serverName = "stcp_Dashboard"
secretKey = "uuid"
bindPort = -1
transport.useCompression = true
[[visitors]]
name = "xtcp_Dashboard_visitor"
type = "xtcp"
serverName = "xtcp_Dashboard"
secretKey = "uuid"
bindAddr = "127.0.0.1"
# 监听本地82端口
bindPort = 82
transport.useCompression = true
keepTunnelOpen = true
fallbackTo = "stcp_Dashboard_visitor"
fallbackTimeoutMs = 200
#远程 frps Dashboard结束
启动frpc
进入到frpc目录下
winsw.exe restart