一.在公网上的ubuntu系统
1.配置文件:
frps.toml
bindPort = 7000 # The default value is 127.0.0.1. Change it to 0.0.0.0 when you want to access it from a public network. webServer.addr = “0.0.0.0” webServer.port = 7500 # dashboards username and password are both optional webServer.user = “admin” webServer.password = “admin” vhostHTTPPort = 80802.启动脚本
serverstart.sh
#!/bin/bash FRP_DIR=`pwd` docker stop frps docker rm frps docker run -d –restart always –network host –name frps -v ${FRP_DIR}/frps.toml:/etc/frp/frps.toml snowdreamtech/frps3.运行
./serverstart.sh之后可以在浏览器查看状态: ip:7500
二.内网ubuntu系统
1.配置文件
frpc.toml
# frpc.toml serverAddr = “192.168.1.132” serverPort = 7000 [[proxies]] name = “ssh” type = “tcp” localPort = 22 remotePort = 6022注:serverAddr指向公网ip;即用公网ip替换192.168.1.132
2.启动脚本
clientstart.sh
#!/bin/bash FRP_DIR=`pwd` docker stop frpc docker rm frpc docker run -d –restart always –network host –name frpc -v ${FRP_DIR}/frpc.toml:/etc/frp/frpc.toml snowdreamtech/frpc3.运行
./clientstart.sh4.测试
上述配置是一个把内网ssh服务的22号端口映射到公网的6022端口,执行命令
ssh -p 6022 192.168.1.132即可从外网访问内网ssh服务
注:用公网ip替换192.168.1.132
© 版权声明
THE END
暂无评论内容