当前位置:网站首页>基于frp实现内网穿透——借助公网服务器实现ssh远程连接内网服务器
基于frp实现内网穿透——借助公网服务器实现ssh远程连接内网服务器
2022-07-27 12:51:00 【Winter_Prince】
设备准备
一台可以使用的公网的服务器、一台可以访问web的内网 X X X的计算机,一台可以访问web的不属于内网 X X X的计算机。
文件准备
下载对应文件 传送门
linux下进行解压的命令:
tar -zxvf frp_0.44.0_linux_amd64.tar.gz
客户端是指要被ssh访问的计算机。
服务端是指公网IP的计算机。
运行文件配置
# frps.ini
[common]
bind_port = 7000 # 公网服务器开启的端口
# frpc.ini
[common]
server_addr = # 公网服务器的IP地址
server_port = 7000 # 公网服务器开启的端口
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000 # 这个端口是用于代理的端口
文件运行
服务端运行
./frps -c ./frps.ini
客户端运行
./frpc -c ./frpc.ini
非内网计算机ssh连接
ssh -oPort=6000 [email protected] #x.x.x.x是公网服务器的IP
开启端口
查看是否连接成功,如果没有成功,要检查一下公网服务器的防火墙的端口是否打开。
6000和7000的端口都要打开。
netstat -ntulp # 查询已开放的端口
netstat -ntulp | grep 端口号 # 可以具体查看某一个端口号
firewall-cmd --query-port=6000/tcp # 查询指定端口是否已开,提示 yes,表示开启;no表示未开启。
firewall-cmd --add-port=6000/tcp --permanent # 添加指定需要开放的端口
firewall-cmd --add-port=7000/tcp --permanent # 添加指定需要开放的端口
firewall-cmd --reload # 重载入添加的端口
firewall-cmd --query-port=6000/tcp # 查询指定端口是否开启成功
firewall-cmd --permanent --remove-port=6000/tcp # 移除指定端口
firewall-cmd --permanent --remove-port=7000/tcp # 移除指定端口
备注:运行公网服务器为ubuntu20.04,指令集是amd64的,如果需要其他架构,可以访问 仓库进行下载对应架构的软件版本,版本不对应会出现core dump之类的运行报错。
边栏推荐
- v-show
- Amd adrenalin 22.7.1 driver update: double the performance of OpenGL and support Microsoft win11 22h2 system
- clear
- Talk about one of the important classes of feign components, reactivefeign
- 电滑环的常用类型
- Absolute positioning
- Delay queue performance test
- Insert sort, positive order, reverse order
- 滑环设备怎么进行维护
- 写出一个程序,接受一个有字母和数字以及空格组成的字符串,和一个字符,然后输出输入字符串中含有该字符的个数。不区分大小写。
猜你喜欢

电滑环的常用类型

Baoli food listed on Shanghai Stock Exchange: annual revenue of 1.578 billion, market value of 5.8 billion

AMD Adrenalin 22.7.1 驱动更新:OpenGL 性能翻倍,支持微软 Win11 22H2 系统

Have you understood these 30 questions of enabling financial risk control plus points

开源项目丨Taier1.2版本发布,新增工作流、租户绑定简化等多项功能

滑环设备怎么进行维护

PAT乙级 1109 擅长C(详解)

常见分布式理论(CAP、BASE)和一致性协议(Gosssip、Raft)

QT excellent open source project 13: qscintilla

Jesd204b debugging notes (practical version)
随机推荐
Minimally invasive brain science broke the listing: the company's market value is HK $14.3 billion, and minimally invasive medical is the major shareholder
Seata 在蚂蚁国际银行业务的落地实践
Firefox 103 release, faster and more secure
Go语言系列:如何搭建Go语言开发环境?
592. Fraction addition and subtraction: introduction to expression calculation
clear
【基础知识】~ 集成电路设计流程,以及各阶段所使用的EDA工具
Interview site: three kinds of questions
Initializing database error after reinstalling MySQL
Final solution for high collapse (no side effects)
v-on基础指令
Multi activity disaster recovery construction after 713 failure of station B | takintalks share
Pat class B 1109 good at C (detailed)
纵横靶场-图片的奥秘
Application of responsibility chain model in transfer accurate valuation
轮播图
力扣 1480. 一维数组的动态和 383. 赎金信412. Fizz Buzz
从tidb实时同步到mysql 只能用 tidb binlog 工具吗?
完美指南|如何使用 ODBC 进行无代理 Oracle 数据库监控?
能说一说 Kotlin 中 lateinit 和 lazy 的区别吗?