1. frp简介
https://gofrp.org/zh-cn/docs/
2. 安装配置frp服务端
2.1 测试环境
2.2 下载frp
https://github.com/fatedier/frp/releases/download/v0.59.0/frp_0.59.0_linux_amd64.tar.gz
2.3 部署frp
tar -zxf frp_0.59.0_linux_amd64.tar.gz
mkdir /usr/share/frps
cp frp_0.59.0_linux_amd64/frps* /usr/share/frps/
2.4 启动服务
cd /usr/share/frps
./frps -c .frps.toml #启动服务端
vi /etc/systemd/system/frps.service
[Unit]
Description = frp server
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
ExecStart = /usr/share/frps/frps -c /usr/share/frps/frps.toml
[Install]
WantedBy = multi-user.target
systemctl start frps
systemctl enable frps
3. 安装配置frp客户端
3.1 客户端环境
3.2 下载frp
https://github.com/fatedier/frp/releases/download/v0.59.0/frp_0.59.0_linux_amd64.tar.gz
3.3 部署frp
tar -zxf frp_0.59.0_linux_amd64.tar.gz
mkdir /usr/share/frpc
cp frp_0.59.0_linux_amd64/frpc* /usr/share/frpc/
3.4 修改配置文件
vi /usr/share/frpc/frpc.toml
serverAddr = "43.133.213.44"
serverPort = 7000
[[proxies]]
name = "ssh01"
type = "tcp"
localIP = "192.168.211.101"
localPort = 80
remotePort = 6000
3.5 启动服务
vi /etc/systemd/system/frpc.service
[Unit]
Description = frp client
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
ExecStart = /usr/share/frpc/frpc -c /usr/share/frpc/frpc.toml
[Install]
WantedBy = multi-user.target
systemctl start frpc
systemctl enable frpc
4. 访问测试
5. 增加服务端与客户端之间的认证
5.1 修改服务端配置
vi /usr/share/frps/frps.toml
bind_port = 7000
auth.token = "Aa123456"
systemctl restart frps
reconnect to server error: token in login doesn't match token from configur...nother retry
5.2 修改客户端配置
vi /usr/share/frpc/frpc.toml
serverAddr = "43.133.213.44"
serverPort = 7000
auth.token = "Aa123456"
[[proxies]]
name = "ssh01"
type = "tcp"
localIP = "192.168.211.101"
localPort = 22
remotePort = 6000
systemctl restart frpc
6. 总结
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容