frp内网穿透搭建

服务器端frp下载地址


https://github.com/fatedier/frp/releases

[root@server01 frp_0.45.0_linux_amd64]# ll
total 25256
-rwxr-xr-x 1 1001 docker 11374592 Oct 26 23:24 frpc
-rw-r--r-- 1 1001 docker    10934 Oct 26 23:30 frpc_full.ini
-rw-r--r-- 1 1001 docker      126 Oct 26 23:30 frpc.ini
-rwxr-xr-x 1 1001 docker 14446592 Oct 26 23:24 frps
-rw-r--r-- 1 1001 docker     5686 Oct 26 23:30 frps_full.ini
-rw-r--r-- 1 1001 docker       26 Oct 26 23:30 frps.ini		# 配置文件
-rw-r--r-- 1 1001 docker    11358 Oct 26 23:30 LICENSE

编辑配置文件frps.ini

[common]
bind_port = 7000
token = xxxxx			# 根据习惯编写一个复杂的字符串

启动

[root@server01 frp_0.45.0_linux_amd64]# ./frps -c ./frps.ini
2022/11/11 14:04:47 [I] [root.go:206] frps uses config file: ./frps.ini
2022/11/11 14:04:47 [I] [service.go:196] frps tcp listen on 0.0.0.0:7000
2022/11/11 14:04:47 [I] [root.go:215] frps started successfully

# 关闭连接后不关闭服务
[root@server01 frp_0.44.0_linux_amd64]# nohup  ./frps -c frps.ini > runoob.log 2>&1 &
[1] 2370135
[root@server01 frp_0.44.0_linux_amd64]# jobs
[1]+  Running                 nohup ./frps -c frps.ini > runoob.log 2>&1 &

window端下载地址同上

https://github.com/fatedier/frp/releases

修改配置文件frpc.ini
在这里插入图片描述

windows中启动脚本

@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
C:\Users\Admin\Desktop\frp_0.44.0_windows_amd64\frpc.exe -c C:\Users\Admin\Desktop\frp_0.44.0_windows_amd64\frpc.ini

linux作为客户端

使用systemd将其安装为服务
vim /etc/systemd/system/frpc.service
[Unit]
Description = frp client
After = network.target syslog.target
Wants = network.target
[Service]
Type = simple
ExecStart =/root/software/frp/frp_0.45.0_linux_amd64/frpc -c /root/software/frp/frp_0.45.0_linux_amd64/frpc.ini

[Install]
WantedBy = multi-user.target
使用 systemd 命令,管理 frpc
systemctl start frpc
systemctl enable frpc
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值