简单 高效的内网穿透工具
服务器
frps -c frps.toml
bindPort = 7000
客户端
frpc -c frpc.toml
serverAddr = "服务器IP"
serverPort = 7000
# 使用 tcp 暴露 22 端口 , 通过 服务器IP:10022 去访问
[[proxies]]
name = "tcp_22"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22
remotePort = 10022
# 使用安全的 tcp 暴露 22 端口
[[proxies]]
name = "stcp_22"
type = "stcp"
secretKey = "secretKey"
localIP = "127.0.0.1"
localPort = 22
# 使用 p2p 暴露 22 端口
[[proxies]]
name = "xtcp_22"
type = "xtcp"
secretKey = "secretKey"
localIP = "127.0.0.1"
localPort = 22
本地机器
frpc -c frpc.toml
serverAddr = "服务器IP"
serverPort = 7000
# 通过 127.0.0.1:10021 安全的访问客户端的 22 端口
[[visitors]]
name = "stcp_22_visitors"
type = "stcp"
serverName = "stcp_22"
secretKey = "secretKey"
bindAddr = "127.0.0.1"
bindPort = 10021
# p2p 打通后通过 127.0.0.1:10022 安全的访问客户端的 22 端口
[[visitors]]
name = "xtcp_22_visitor"
type = "xtcp"
serverName = "xtcp_22"
secretKey = "secretKey"
bindAddr = "127.0.0.1"
bindPort = 10022
keepTunnelOpen = true # 保持隧道打开
fallbackTimeoutMs = 30000 # 如果打洞失败超过30秒
fallbackTo = "stcp_22_visitors" # 则通过上方的 stcp_22_visitors 去访问
Linux服务运行
服务端 /etc/systemd/system/frps.service
客户端 /etc/systemd/system/frpc.service
[Unit]
# 服务名称,可自定义
Description = frps or frpc server
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
# 启动frps或frpc的命令,需修改为您的frp的安装路径
# 服务端 选其一
ExecStart = /webapps/frp_0.60.0_linux_amd64/frps -c /webapps/frp_0.60.0_linux_amd64/frps.toml
# 客户端 选其一
ExecStart = /webapps/frp_0.60.0_linux_amd64/frpc -c /webapps/frp_0.60.0_linux_amd64/frpc.toml
Restart = on-failure
RestartSec = 5s
StartLimitInterval = 0
StartLimitBurst = 0
[Install]
WantedBy = multi-user.target
接下来以服务的方式管理,以服务端 frps 为例,客户端则改成 frpc
# 设置开机自启动
systemctl enable frps
# 启动
systemctl start frps
# 重启
systemctl restart frps
# 停止
systemctl stop frps
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
One piece!
喜欢就支持一下吧