当前位置:网站首页>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服务端也显示了信息
边栏推荐
- Yum to see which installation package provides a command
- SHP building contour data restoration, 3D urban white film data production
- E d-piece system is nfdavi oriented, reaching a high level for engineers
- Chapter 9 using image data
- Two methods of modifying configuration files in PHP
- Xiaohongshu joins hands with HMS core to enjoy HD vision and grow grass for a better life
- Chapter III encog workbench
- power. The operation is in the low peak period of business. Import call will help you prepare each word
- 项目普遍格式问题 src下添加 .eslinctrc.js
- The second chapter is encog's data acquisition
猜你喜欢

uniapp学习

Zhaoyi innovation gd25wdxxk6 SPI nor flash product series comes out
![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?

The second chapter is encog's data acquisition

Print leap years between 1000 and 2000

MGRE and OSPF comprehensive experiment

Chapter 7 other neural network types

A hospital call system based on C language

Post SQL era: edgedb 2.0 Release Notice

Journey of little black leetcode: 590. Post order traversal of n-ary tree
随机推荐
The software cannot be uninstalled. Please wait for the current program to complete the uninstallation or change the solution
mapreduce概念
Rlib learning - [4] - algorithmconfig detailed introduction [pytoch version]
A hospital call system based on C language
Xiaohongshu joins hands with HMS core to enjoy HD vision and grow grass for a better life
LeetCode 46 全排列
Forward proxy, reverse proxy and XFF
Uniapp learning
Icml2022 | rock: causal reasoning principle on common sense causality
Leetcode 46 full arrangement
It is related to the amount of work and ho. Embedded, only one 70 should be connected
What if the notepad file is too large to open? Introduction to the solution to the phenomenon that txt files are too large to be opened
yum 查看某个命令由哪个安装包提供
C language: bubble sorting
What is the sandbox technology in the data anti disclosure scheme?
几种常见的排序
Transpose of array sparse matrix
What if IPv4 has no internet access? Solutions to IPv4 without internet access rights (detailed explanation of pictures and texts)
节都需能有问题制端口, 第一个下标 。很多机器成
Chiitoitsu(期望dp)