内网穿透产品 frp ngrok FastTunnel

目录

[一,frp 内外穿透 ,自己搭建内网穿透服务,需要服务器](#一,frp 内外穿透 ,自己搭建内网穿透服务,需要服务器)

[1 服务器端配置 frps.ini](#1 服务器端配置 frps.ini)

[2 想要 frps 随系统启动,可以使用系统服务管理器,](#2 想要 frps 随系统启动,可以使用系统服务管理器,)

[3 客户端 frpc.ini 配置](#3 客户端 frpc.ini 配置)

[4 用nginx映射端口号的路径到不同的端口,避免公网ip暴露过多的端口号,](#4 用nginx映射端口号的路径到不同的端口,避免公网ip暴露过多的端口号,)

5,远程登录内网linux主机配置

1)阿里云主机放开ssh登录端口2223(随便选一个端口)

2)内网linux客户端frpc.ini增加配置

3)连接配置连接配置)

4)测试连接测试连接)

6,远程连接windows主机配置

[二,ngrok 国外的免费的内网穿透工具,不需要服务器,很慢](#二,ngrok 国外的免费的内网穿透工具,不需要服务器,很慢)

[0. 在自己电脑跑一个web服务,端口 8080](#0. 在自己电脑跑一个web服务,端口 8080)

[1. Unzip to install](#1. Unzip to install)

[2. Connect your account](#2. Connect your account)

[3. Fire it up](#3. Fire it up)

[三,FastTunnel 国内开源产品,需要公网服务器](#三,FastTunnel 国内开源产品,需要公网服务器)


一,frp 内外穿透 ,自己搭建内网穿透服务,需要服务器

客户端,服务端根据不同的系统分别下载不同的版本

下载地址:

Releases · fatedier/frp (github.com)

1 服务器端配置 frps.ini

bash 复制代码
# frps.ini

[common]
bind_port = 7000

bind_addr = 0.0.0.0
# 用于身份验证,请自行修改,要保证服务端与客户端一致
token = 123456
# 运行日志文件
log_file = /var/log/frps.log
# 是否以守护进程方式运行
daemon = true

启动命令 测试配置是否正确

bash 复制代码
# 连接窗口关闭或ctrl+c停止运行
 ./frps -c ./frps.ini 

2想要 frps 随系统启动,可以使用系统服务管理器,

如 systemd 来创建服务文件。以下是一个 systemd 服务文件示例(frps.service):

bash 复制代码
[Unit]
Description=FRP Server Service
After=network.target

[Service]
Type=simple
ExecStart=/path/to/frps -c /path/to/frps.ini
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

将 frps.service 文件保存到 /etc/systemd/system/ 目录下,然后使用以下命令启用和启动 frps 服务:

bash 复制代码
 
#systemctl enable frps.service 这一条命令的作用是启用(或称为激活)一个 systemd 服务单元(在这个例子中是 frps.service),以确保该服务在系统启动时自动运行。
#具体来说,当你执行 systemctl enable frps.service 时,systemd 会执行以下操作:
#它会查找你提供的服务单元文件(在这个例子中是 frps.service),这个文件通常位于 /etc/systemd/system/、/lib/systemd/system/ 或其他 systemd 服务单元文件目录中。
#一旦找到服务单元文件,systemd 会创建一个指向该文件的符号链接(symlink)在 /etc/systemd/system/multi-user.target.wants/ 或其他类似的目标(target)目录中。这个符号链接#的创建是 enable 命令的主要工作。
#当系统启动到 multi-user.target(也就是通常的图形界面或多用户模式)时,systemd 会遍历这些目标目录中的符号链接,并启动它们所指向的服务单元文件定义的服务。
#因此,当系统下次启动时,frps 服务将自动启动,而无需你手动执行 systemctl start frps.service 命令。
sudo systemctl enable frps.service  # 激活服务
sudo systemctl start frps.service    # 启动服务
sudo systemctl stop frps.service    # 停止服务
sudo systemctl status frps.service    # 查看服务状态

3 客户端 frpc.ini 配置

bash 复制代码
[common]
server_addr = 106.xxx.xxx.xxx
server_port = 7000
token = 123456

# 把公网106.xxx.xxx.xxx:8600 映射到本地8000端口
[park]
type = tcp
local_ip = 127.0.0.1
local_port = 8000
remote_port = 8600

# 把公网106.xxx.xxx.xxx:8601映射到本地8001端口
[pay]
type = tcp
local_ip = 127.0.0.1
local_port = 8001
remote_port = 8601

启动客户端 ,公网ip:106.xxx.xxx.xxx 暴露 7000,8600,8601端口号

bash 复制代码
 frpc -c ./frpc.ini

4 用nginx映射端口号的路径到不同的端口,避免公网ip暴露过多的端口号,

5,远程登录内网linux主机配置

1)阿里云主机放开ssh登录端口2223(随便选一个端口)

2)内网linux客户端frpc.ini增加配置

复制代码
[ssh_pi]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 2223

3)连接配置

4)测试连接

6,远程连接windows主机配置

Windows远程桌面配置(阿里云ECS服务器+frp+windows远程桌面配置)_云服务器ecs windows-CSDN博客

参考

frp内网穿透_frps-CSDN博客

https://www.cnblogs.com/cenima/p/17849921.html

开源内网穿透工具 frp 简单使用教程 - 个人文章 - SegmentFault 思否

二,ngrok 国外的免费的内网穿透工具,不需要服务器,很慢

注册ngrok - Online in One Line

官网有各种系统部署方法,支持win,mas,linux,raspberry...等各种平台

0. 在自己电脑跑一个web服务,端口 8080

1. Unzip to install

On Linux or Mac OS X you can unzip ngrok from a terminal with the following command. On Windows, just double click ngrok.zip to extract it.

复制代码
unzip /path/to/ngrok.zip

2. Connect your account

Running this command will add your authtoken to the default ngrok.yml configuration file. This will grant you access to more features and longer session times. Running tunnels will be listed on the endpoints page of the dashboard.

复制代码
ngrok config add-authtoken 你的token

3. Fire it up

To start a HTTP tunnel forwarding to your local port 80, run this next:

复制代码
ngrok http 8080

三,FastTunnel 国内开源产品,需要公网服务器

快速上手 | FastTunnel (suidao.io)

相关推荐
闲云一鹤1 天前
nginx 快速入门教程 - 写给前端的你
前端·nginx·前端工程化
chlk1231 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑1 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件1 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
碳基沙盒1 天前
OpenClaw 多 Agent 配置实战指南
运维
深紫色的三北六号2 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash2 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI2 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行3 天前
Linux和window共享文件夹
linux
木心月转码ing3 天前
WSL+Cpp开发环境配置
linux