当前位置:网站首页>frp内网穿透服务使用
frp内网穿透服务使用
2022-07-24 05:00:00 【斧头湖懒客】
一、frp内网穿透
1,frp简介
frp 是一个专注于内网穿透的高性能的反向代理应用,支持 TCP、UDP、HTTP、HTTPS 等多种协议。可以将内网服务以安全、便捷的方式通过具有公网 IP 节点的中转暴露到公网。
有了内网穿透你能干什么?
- 远程访问内网的 http/https 服务
- 远程桌面(Windows/Mac)
- 远程文件、 SSH
- 小程序开发
有了内网穿透在外访问家里的电脑、NAS、树莓派、摄像头等网络设备或远程控制,那都不是事儿~
frp是一个开源的内网穿透应用,有客户端软件和服务端软件,大概工作过程如下:
服务端运行在具有公网IP的服务器上,比如Linux上,并监听某个端口,等待客户端连接。
客户端运行在需要穿透的内网机器上,比如本地电脑上,连接到服务器之后,服务器开始监听客户端需要穿透的指定端口。
外网用户连接服务器监听的指定端口,然后服务器将用户数据转发到内网客户端,实现内网穿透
frp工作原理
服务端运行,监听一个主端口,等待客户端的连接;
客户端连接到服务端的主端口,同时告诉服务端要监听的端口和转发类型;
服务端fork新的进程监听客户端指定的端口;
外网用户连接到客户端指定的端口,服务端通过和客户端的连接将数据转发到客户端;
客户端进程再将数据转发到本地服务,从而实现内网对外暴露服务的能力。
原来简单解释
服务器端和客户端约定通过7000端口通信,客户端告诉服务端要监听6000端口(客户端配置的remote_port =6000),然后外网服务器就会监听是否有连接请求:外网服务器Ip地址:6000,如果有就把连接给客户端,这样就可以达到内网穿透的目的。
2,frp下载
准备一个阿里云服务器,准备安装frp服务端
下载地址:https://github.com/fatedier/frp/releases

2,解压
将下载的Linux压缩包上传到服务器上解压。
tar -xvf frp_0.38.0_linux_amd64.tar.gz
解压之后目录结构
这里可以选择把客户端没有的程序和配置删掉,也可不删
rm -f frpc*

3,服务端配置
编辑服务端配置文件frps.ini
vi frps.ini
[common] # 必须配置
bind_port = 7000 # 是自己设定的frp服务端端口
# 只用设置上面一个端口就可以了,下面的配置信息不用管,供参考
token = 123 #设置密码,为了安全
vhost_http_port = 7080 # 是自己设定的http访问端口
dashboard_port = 7010 # 服务器web管理端口
dashboard_user = yang # 服务器web界面用户名
dashboard_pwd = 123456 # 服务端web界面密码
[ssh] # ssh反向代理(不是必须设置)
listen_port = 6000 # 是自己设定的ssh访问端口
[web] # http反向代理[]里的内容自己设定,但是客户端和服务端必须要对应(如[aaa],[bbb]);
type = http # 为服务类型,可以设置为http,https
custom_domains = test1.a.com # 为要映射的域名,记得域名的A记录要解析到外网主机的IP
[web2] # 同上(可设置多个)
启动服务端
./frpc -c ./frpc.ini
# 后台启动
nohup ./frpc -c ./frpc.ini &
4,客户端配置
我这里的客户端是自己的本地电脑
本地电脑解压Windows版本的frp,修改客户端配置文件frpc.ini
[common]
# 远程frp服务端ip
server_addr = 39.xxx.xxx.xxx
# 远程frp服务端端口
server_port = 7000
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000 # 外网服务器要监听的端口
电脑黑窗口启动frp.exe
frpc.exe -c frpc.ini

客户端启动后,Linux服务端也显示了信息
边栏推荐
- How to make yourself look young in how old robot? How old do I look? Younger method skills
- How can I open and view the bin file? Diagram of reading method of bin file backed up by router
- What does the red five pointed star in the lower right corner of sina Weibo avatar mean? How to become a master of sina Weibo?
- Chapter 0 Introduction to encog
- Ben, reducing online importance is the same. Abnormal instance CP operation found
- What if IPv4 has no internet access? Solutions to IPv4 without internet access rights (detailed explanation of pictures and texts)
- Memorandum 2022
- Solution to the prompt of online account opening and transfer in stock speculation that the depository and transfer services are not activated (China Merchants Bank)
- P一个配置文件期间将SDA松集成。支但事实上
- 作、Ho量有关。嵌入,只有一70的该接
猜你喜欢

Jiang Xingqun, senior vice president of BOE: aiot technology enables enterprise IOT transformation

HMS core discovery Episode 16 live broadcast preview | play AI's new "sound" state with tiger pier

pso和mfpso

Basic syntax of MySQL DDL and DML and DQL

-Bash: wget: command not found

Chapter 7 other neural network types

Middle aged crisis, workplace dad who dare not leave, how to face life's hesitation

Want to know how a C program is compiled—— Show you the compilation of the program

Problems and solutions of QT (online installation package) crash in win10 installation

472-82 (22, 165, 39, sword finger offer II 078, 48. Rotate image)
随机推荐
Event extraction and documentation (2020-2021)
What if the computer desktop gets stuck? Introduction of solutions to computer crash and desktop jamming
Yolov7 -- brief introduction of the paper
Mysq Database Constraints
Leetcode 46 full arrangement
几种常见的排序
[network counting experiment report] Cisco LAN Simulation and simple network test
Learn more about the new features of ES6 in grain mall of e-commerce project
激活函数和最常用的10个激活函数
Logback log framework technology in project development
High performance architecture design of wechat circle of friends
Want to know how a C program is compiled—— Show you the compilation of the program
Chapter 9 using image data
What programmer is still being grabbed by the company at the age of 35? Breaking the "middle-aged crisis" of programmers
[essay] goodbye to Internet Explorer, and the mark of an era will disappear
格式问题处理
What does the red five pointed star in the lower right corner of sina Weibo avatar mean? How to become a master of sina Weibo?
Chapter 0 Introduction to encog
HMS core discovery Episode 16 live broadcast preview | play AI's new "sound" state with tiger pier
Share a login interface template of QT implementation