当前位置:网站首页>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服务端也显示了信息
边栏推荐
- [network counting experiment report] Cisco LAN Simulation and simple network test
- Logback log framework technology in project development
- Print leap years between 1000 and 2000
- What programmer is still being grabbed by the company at the age of 35? Breaking the "middle-aged crisis" of programmers
- mapreduce概念
- [essay] goodbye to Internet Explorer, and the mark of an era will disappear
- How to play the Microsoft twin tool twinsonot? Introduction to twin test tool twinornot
- How to make the words on the screen larger (setting method to make the text more comfortable on the large screen)
- Why can't I log on my baidu account? Introduction to the solution of baidu account unable to log in
- Event extraction and documentation (2019)
猜你喜欢

Chapter 7 other neural network types

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

Event extraction and documentation (2019)

The x-fkgom supporting the GOM engine key.lic is authorized to start

Kingbase v8r6 cluster installation and deployment case - script online one click capacity reduction

Little black gnawing leetcode:589. Preorder traversal of n-ary tree

pso和mfpso
![[postgraduate entrance examination vocabulary training camp] day 10 - capital, expand, force, adapt, depand](/img/9a/a218c46806cf286f0518a72809e084.png)
[postgraduate entrance examination vocabulary training camp] day 10 - capital, expand, force, adapt, depand

一文带你深入浅出C字符串函数和内存函数

Zhaoyi innovation gd25wdxxk6 SPI nor flash product series comes out
随机推荐
PHP修改配置文件的两种方法
最大公约数
JDBC MySQL basic operations
Mysq Database Constraints
[postgraduate entrance examination vocabulary training camp] day 10 - capital, expand, force, adapt, depand
Event extraction and documentation (2019)
What if the computer time is often inaccurate? Set up tutorials to automatically update and proofread computer time
PSO and mfpso
项目普遍格式问题 src下添加 .eslinctrc.js
Memorandum 2022
Why can't I log on my baidu account? Introduction to the solution of baidu account unable to log in
Excel cell formula - realize Ackerman function calculation
What if the computer can't take screenshots? The solution to the problem that the shortcut screen capture key of the computer cannot be used
OWA dynamic password SMS authentication scheme solves the problem of outlook email two factor authentication
Uniapp learning
All sections need to be able to have a problem system port, the first subscript. Many machines become
To 3mm; Provide safe and stable product execution according to the sender IID
Illustration and text demonstrate the movable range of the applet movable view
想知道一个C程序是如何进行编译的吗?——带你认识程序的编译
Journey of little black leetcode: 590. Post order traversal of n-ary tree