内网远程连接解决方案【Frp】

1、从https://github.com/fatedier/frp/releases下载需要的版本,如

frp_0.61.0_linux_amd64.tar.gz

2、解压tar -xvf frp_0.61.0_linux_amd64.tar.gz

3、配置服务端【外网云主机】,修改ftps.toml文件:

bindPort = 7000

vhostHTTPPort=8000

auth.method="token"

auth.token="test-token"

webServer.port=7500

webServer.addr="0.0.0.0"
webServer.user="admin"

webServer.password="admin"

4、移动文件:

mkdir -p /etc/frp

cp frps  /usr/bin

cp frps.toml /etc/frp/

5、创建服务文件:

touch  /usr/lib/systemd/system/frps.service 

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

[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/frps -c /etc/frp/frps.toml

[Install]
WantedBy=multi-user.target

6、启动服务:systemctl start frps

7、配置客户端【内网主机】,配置frpc.toml:

serverAddr = "x.x.x.x"                # 服务端IP地址
serverPort = 7000                    # 服务端通信端口

auth.method = "token"
auth.token = "password"              # token 与服务端保持一直

[[proxies]]
name = "ssh"
type = "tcp"
localIP = "127.0.0.1"
localPort = 22                        # 本地端口号
remotePort = 6000                   # 公网端口号

[[proxies]]
name = "web"
type = "http"    
localIP = "127.0.0.1"                # 本地监听地址和端口
localPort = 80                        # 本地监听端口
customDomains = ["web.test.com"]     # 域名或者IP
8、启动客户端连接:./frpc -c ./frpc.toml

9、连接测试,在外网服务器中使用:ssh 127.0.0.1 -p6000

参考链接:

1、frp新版toml配置:https://blog.youkuaiyun.com/qq233325332/article/details/136065890

2、ubuntu20.04配置安装frp内网穿透,ubuntu20.04配置安装frp内网穿透_ubuntu frp-优快云博客

3、使用 systemd 管理 frp 服务,https://juejin.cn/post/6972566180896702477

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值