侧边栏壁纸
博主头像
博客技术 博主等级

行动起来,活在当下

  • 累计撰写 42 篇文章
  • 累计创建 4 个标签
  • 累计收到 3 条评论

目 录CONTENT

文章目录

Frp内网穿透

Administrator
2025-03-23 / 0 评论 / 0 点赞 / 13 阅读 / 0 字

Githup:GitHub - fatedier/frp: A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.

一、文件下载

下载客户端 和服务端

二、文件上传

#打开/usr/local路径文件夹 
cd /usr/local

#创建frp文件夹,并且进入 
mkdir frp && cd frp

#解压frp_0.60.0_linux_amd64 (4).tar.gz文件,并打开frp_0.60.0_linux_amd64 
tar -zxvf 'frp_0.60.0_linux_amd64 (4).tar.gz' && cd 'frp_0.60.0_linux_amd64'

三、文件配置

#编辑frps配置文件 
vi frps.toml

# 客户端与服务连接端口 
bindPort = 7000 
# 客户端连接服务端时认证的密码 
auth.token = "abcjc" 
# http协议监听端口 
vhostHTTPPort = 28080 
# web界面配置 
webServer.addr = "0.0.0.0" 
webServer.port = 7500 
webServer.user = "admin" 
webServer.password = "admin"

四、创建 frps.service 文件

#编辑/etc/systemd/system/frps.service文件 
sudo vi /etc/systemd/system/frps.service
[Unit] 
Description=frp server 
After=network.target syslog.target 
Wants=network.target 
[Service] 
Type=simple 
ExecStart=/usr/local/frp/frp_0.60.0_linux_amd64/frps -c /usr/local/frp/frp_0.60.0_linux_amd64/frps.toml 
[Install] 
WantedBy=multi-user.target
#检查frp配置文件是否正确 
sudo systemctl status frps.service

五、运行frps服务

# 启动frp 
sudo systemctl start frps 
# 停止frp 
sudo systemctl stop frps 
# 重启frp 
sudo systemctl restart frps
#设置开机自启
sudo systemctl enable frps

运行成功截图

运行失败截图

问题解决:是因为没权限,

#地址改成自己的,然后重启命令+检查状态命令
sudo chmod +x /usr/local/frp/frp_0.60.0_linux_amd64

六、客户端配置

编辑frps配置文件frpc.toml

serverAddr = "服务器的公网IP" 
serverPort = 7000 
auth.token = "abcjc"

#HTTP的配置 
[[proxies]] 
name = "blog" 
type = "http" 
localIP = "127.0.0.1" 
localPort = 8080 
customDomains = ["abcj.cn"]

#TCP的配置 
[[proxies]] 
name = "rdp" 
type = "tcp" 
localIP = "127.0.0.1" 
localPort = 3389 
remotePort = 23389

七、客户端运行

frpc.exe -c frpc.toml

0

评论区