frp内网穿透【实现本地服务映射到云服务器】
jerem1ah Lv4

frp内网穿透【实现本地服务映射到云服务器】

【参考官方文档】https://frps.cn/11.html

1.安装frp

选择合适版本下载:https://github.com/fatedier/frp/releases

image-20221224003451169

将下载好的压缩包解压frps放到具有公网ip的服务器上;frpc放到内网主机上;

image-20221224003700946

image-20221224003830820

2.配置服务

按照官方文档去进行配置frps.ini和frpc.ini

http服务具体实例如下:

1
2
3
4
#frps.ini
[common]
bind_port = 8004
vhost_http = 8005
1
2
3
4
5
6
7
8
9
#frpc.ini
[common]
server_addr = xx.xx.xx.xx
server_port = 8004

[web]
type = http
local_port = 8080
custom_domains = xx.xx.xx.xx

此时通过公网ip:8005即可访问内网的8080服务

image-20221224004624532

3.结语

在配置[ssh]服务时失败了,排查原因时发现局域网内ssh也失败,可能是系统的原因。于是尝试了http服务成功了

4.补充

1
2
3
4
5
6
7
8
9
10
11
#frps.ini
[common]
bind_port = 8004
token = random

vhost_http = 8005

dashboard_port = 8003
dashboard_user = admin
dashboard_pwd = admin

1
2
3
4
5
6
7
8
9
10
#frpc.ini
[common]
server_addr = xx.xx.xx.xx
server_port = 8004
token = random

[web]
type = http
local_port = 8080
custom_domains = xx.xx.xx.xx
 Comments