FRP的使用和介绍

公网私网实现端口映射

虽然现在宽带速度都很快,但对于电脑玩家来说,最大的问题是“没有公网 IP”!这使得想要在外访问家里的电脑、NAS、树莓派、摄像头等网络设备或远程控制等,都无法轻松实现。

 

这时你就需要一款内网穿透工具来让外网与你家内网建立起连接,实现无公网 IP 的远程访问了;这里给大家介绍一款简单实用的端口映射工具==>FRP

 

关于FRP具体什么,大家可以自行百度了解,这里介绍下FRP的结构以及使用:

 

FRP 是一个免费开源的用于内网穿透的反向代理应用,它支持 TCP、UDP 协议, 也为 http 和 https 协议提供了额外的支持。你可以粗略理解它是一个中转站,帮你实现 公网 ←→ FRP(服务器) ←→ 家庭内网 的连接,让内网里的设备也可以被公网访问到。

 
 
 
 
 
 
 
 
 

首先你必须得准备一台公网的VPS服务器,这里推荐大家使用阿里云,腾讯云,在活动期间买贼便宜,三年也就三百来块钱;但是这里有个缺点,就是你的最大网络带宽受制于你服务器的带宽。

 

目前 FRP 推出了“点对点穿透”的试验性功能,连接成功后可以让公网设备直接跟内网设备“点对点”传输,数据流不再经过 VPS 中转,这样可以不受服务器带宽的限制,传输大文件会更快更稳定。当然,此功能并不能保证在你的网络环境 100% 可用,而且还要求访问端也得运行 FRP 客户端 (因此目前手机是无法实现的,只有电脑可以)。由于实现条件较多,所以有文件传输需求的朋友还是建议买带宽稍大一点的 VPS 会比较省心

 

在内网也需要一台机器用于运行 Frp 的客户端,可以是 Windows 电脑、Mac,或者是树莓派、NAS 等 Linux 设备。

 
 

具体文档和源码:https://github.com/fatedier/frp/blob/master/README_zh.md

 

FRP程序包: https://github.com/fatedier/frp/releases

 

FRP国内分流程序包: https://frp.wo25.net:20443/FRP/

 frps.exe -c C:\Server\FRP\frps.ini

FRP的简单配置

 

FRPService配置:

 
 
[common]
#server_addr = ****
#bind_port = 7000
#server_port = 7000
# 绑定本地端口用于访问 ssh 服务
bind_addr = 0.0.0.0
bind_port = 7000
vhost_http_port = 1009
#vhost_http_port = 1010
dashboard_port = 7500
# dashboard 用户名密码,默认都为 admin
dashboard_user = admin
dashboard_pwd = ****
admin_addr = 127.0.0.1
admin_port = 7400
admin_user = *****
admin_pwd = ****
privilege_token = 1234567t
#自定义二级域名
subdomain_host = :1010
 
#TCP 映射配置
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
 
[ssh2]
type = tcp
local_ip = 127.0.0.1
local_port = 23
remote_port = 6001
 

FRPClient配置:

 
 
[common]
server_addr = *******
server_port = 7000
log_file = ./frpc.log
log_level = info
log_max_days = 3
#Admin UI
admin_addr = 127.0.0.1
admin_port = 7400
admin_user = ****
admin_pwd = *****
privilege_token = ******
 
[ssh]
type = tcp
local_ip = 127.0.0.1
#本地端口1009
local_port = 22
#映射远程端口6000
remote_port = 6000
 
[ssh2]
type = tcp
local_ip = 127.0.0.1
#本地端口1009
local_port = 23
#映射远程端口6001
remote_port = 6001
 
[ssh3]
type = tcp
local_ip = 127.0.0.1
#本地端口1009
local_port = 24
#映射远程端口6002
remote_port = 6002
 
[web1]
type = http
local_port = 1201
local_ip = 10.10.22.41
remote_port = 1009
custom_domains = 112.126.59.41
locations = /
 
[web2]
type = http
local_port = 1124
local_ip = 10.10.22.41
remote_port = 1010
#subdomain = 112.126.59.41:1010
custom_domains = 112.126.59.41
locations = /service
 
 
 
 
 

国内提供的免费的frp服务

 

https://frp.wo25.net:27500/static/#/proxies/tcp

posted @ 2020-06-02 10:29  BK小鬼  阅读(2512)  评论(0编辑  收藏  举报