The use of intranet penetration frp

Foreground conditions require a public network server

Download address - go to github to search and download

Server configuration modification frps.ini
[common]
# 服务器端监听客户端连接请求的端口
bind_port = 7000
# 服务器端监听http请求的端口
vhost_http_port = 7070
# frp控制面板
dashboard_port = 7500
# dashboard's username and password are both optional
dashboard_user = admin
dashboard_pwd = admin
# log_file = ./frps.log
#log_level = info
#log_max_days = 3
Client configuration frpc.ini
[common]
server_addr = 公网ip
server_port = 7000 #对应服务端口
[ssh]
type = tcp #协议
local_ip = 127.0.0.1 #本地ip
local_port = 22  #需要映射的端口
remote_port = 7022 # 暴露的端口,访问示例:公网ip:7022 需要开放防火墙

[mysql]
type = tcp
local_ip = 127.0.0.1
local_port = 3306
remote_port = 7306

Server start:

./frps -c frps.ini

Client start:

./frpc -c frpc.ini
The above startup is more troublesome, set it as a service, and it will start automatically after booting
新建 frp.service 文件

vim /lib/systemd/system/frp.service
# 写入以下内容,注意区分 服务端 和 客户端

[Unit]
Description=frp service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
# 服务端  /home/ubuntu/frp文件路径
ExecStart=/home/ubuntu/frp/frps -c /home/ubuntu/frp/frps.ini
# 客户端
# ExecStart=/root/frp/frpc -c /root/frp/frpc.ini
[Install]
WantedBy=multi-user.target
使用 systemctl 启动服务

# 启动frp
systemctl start frp
# 开机自启动
systemctl enable frp
# 重启
systemctl restart frp
# 停止
systemctl stop frp
# 查看日志
systemctl status frp


Guess you like

Origin blog.csdn.net/weixin_43051544/article/details/130064130