- 使用背景:内网环境中服务,端口不满足公网访问
- 使用条件:内网中存在能访问互联网的机器,并且有具有公网访问的其他网络机器
- 拓扑
服务端(frps)
- 服务端必须安装再需要访问内网机器,本地都可以访问到的机器上
1、下载frp
wget https://github.com/fatedier/frp/archive/refs/tags/v0.36.2.tar.gz
2、安装启动frps
- 配置文件如下
[common]
bind_addr=0.0.0.0 #客户端ip
bind_port = 27451 #客户端连接端口
auto_token= 12345678
log_file = /var/log/frps.log
dashboard_port = 7500 #管理端端口
dashboard_user = admin
dashboard_pwd = admin
- 启动frps
/usr/bin/frps -c /etc/frp/frps.ini
客户端端(frps)
- 客户端安装在需要访问的内网机器,并能连接服务端
1、下载frp
wget https://github.com/fatedier/frp/archive/refs/tags/v0.36.2.tar.gz
2、配置启动服务端口
- 配置文件如下
[common]
server_addr = 60.174.236.106
server_port = 27451
log_file = /home/xsw/frp/frpc.log
[ssh登录隧道]
type = tcp
local_ip = 10.226.209.10
local_port = 9999
remote_port = 20910
[mysql_epg_m]
type = tcp
local_ip = 10.226.219.98
local_port = 3306
remote_port = 33098
[mysql_epg_s]
type = tcp
local_ip = 10.226.219.97
local_port = 3306
remote_port = 33097
[mysql_aaa_m]
type = tcp
local_ip = 10.226.219.100
local_port = 3306
remote_port = 33100
[mysql_aaa_s]
type = tcp
local_ip = 10.226.219.99
local_port = 3306
remote_port = 33099
[mysql_zd]
type = tcp
local_ip = 10.226.219.13
local_port = 3306
remote_port = 33013
[mysql_yy]
type = tcp
local_ip = 10.226.219.96
local_port = 3306
remote_port = 33096
[mongo]
type = tcp
local_ip = 10.226.203.10
local_port = 27017
remote_port = 27010
[xxl-job]
type = tcp
local_ip = 10.226.233.7
local_port = 8083
remote_port = 28083
[nacos]
type = tcp
local_ip = 10.226.233.7
local_port = 8088
remote_port = 28088
[sentinel]
type = tcp
local_ip = 10.226.233.7
local_port = 8080
remote_port = 28080
[tms]
type = tcp
local_ip = 10.226.233.11
local_port = 9999
remote_port = 29999
[sso]
type = tcp
local_ip = 10.226.233.11
local_port = 8085
remote_port = 8085
[skywalking]
type = tcp
local_ip = 10.226.219.22
local_port = 8080
remote_port = 18080
- 启动frpc
/usr/bin/frpc -c /etc/frp/frpc.ini