frp内网穿透技术

目的:为了实现外网访问内网服务器,实现内网服务器的穿透
1.准备工作
准备一台云服务器,这里使用阿里云服务器。下载frp,下载地址https://github.com/fatedier/frp/releases

image.png

2、搭建frp服务端,在我们的阿里云服务上,解压
image.png
编辑frps.ini,其中auto_token要和客户端配置的auto_token一致

[common]
bind_addr = 0.0.0.0
bind_port = 4443
auto_token = testtoken

启动服务端:

./frps -c ./frps.ini

3、安装客户端,我使用的是树莓派位于内网,所以下载arm版本
image.png

解压进入安装目录
编辑frpc.ini,假设我们阿里云服务器ip是223.223.223.223


[common]
server_addr = 223.223.223.223
server_port = 4443
auto_token = testtoken

[test1]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 26666

[test2]
type = tcp
local_ip = 127.0.0.1
local_port = 8000
remote_port = 27777

启动客户端

./frpc -c ./frpc.ini

4、这样我们就把树莓派22端口和8000端口代理出去了,可以通过223.223.223.223:26666 和223.223.223.223:27777 访问.记得在阿里云安全组打开26666和27777端口,否则默认是访问不了的。

发布了30 篇原创文章 · 获赞 74 · 访问量 23万+

猜你喜欢

转载自blog.csdn.net/ruiyiin/article/details/104633370