当前位置:网站首页>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服务端也显示了信息
边栏推荐
- Pony activation tool appears cannot open file k:\oemsf solution
- Dictation SC or Pb file is read-write control ensor is
- 想知道一个C程序是如何进行编译的吗?——带你认识程序的编译
- Logback log framework technology in project development
- Technical team: improve team effectiveness, starting from never doing three things
- Recruitment | embedded software (MCU) Engineer
- Summary of the development process and key and difficult points of the Listening Project
- Kingbase V8R6集群安装部署案例---脚本在线一键扩容
- 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)
- Summary of common errors in wechat applet cloud development
猜你喜欢
![GOM engine starts M2 prompt: [x-fkgom] has been loaded successfully. What should I do if it gets stuck?](/img/32/df602f294e009c9462d955b1819ffe.png)
GOM engine starts M2 prompt: [x-fkgom] has been loaded successfully. What should I do if it gets stuck?

Uniapp learning

OWA dynamic password SMS authentication scheme solves the problem of outlook email two factor authentication

Quick reference manual for the strongest collation of common regular expressions (glory Collection Edition)

postgresql:在Docker中运行PostgreSQL + pgAdmin 4

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

Chapter VI more supervision training

智能指针、左值引用右值引用、lambda表达式

Chapter 7 other neural network types
![Rlib learning - [4] - algorithmconfig detailed introduction [pytoch version]](/img/1e/95078ad64a17686463547e8ba87cb1.png)
Rlib learning - [4] - algorithmconfig detailed introduction [pytoch version]
随机推荐
PHP修改配置文件的两种方法
Personalized customized TenPay name customized TenPay is a diagram of any name such as Ma Huateng
[JDBC] error exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communica
Excel cell formula - realize Ackerman function calculation
472-82 (22, 165, 39, sword finger offer II 078, 48. Rotate image)
MGRE and OSPF comprehensive experiment
Kingbase v8r6 cluster installation and deployment case - script online one click expansion
黑色的的一站式运维管家 10条记录RO
Basic syntax of MySQL DDL and DML and DQL
[machine learning] - [traditional classification problem] - naive Bayesian classification + logistic regression classification
How to play the Microsoft twin tool twinsonot? Introduction to twin test tool twinornot
Airiot Q & A issue 5 | how to use low code business flow engine?
Chapter VI more supervision training
一文带你深入浅出C字符串函数和内存函数
LabVIEW主VI冻结挂起
LeetCode 46 全排列
力。操处于业务低峰期。进口调用会帮您准备时,每个字
What if IPv4 has no internet access? Solutions to IPv4 without internet access rights (detailed explanation of pictures and texts)
mapreduce概念
Format problem handling