跳至主要內容

frp内网穿透搭建

xw大约 1 分钟toolsfrp

操作系统

  • centos7

服务端安装

下载服务端:下载链接open in new window,密码:123456,上传到服务器,执行解压命令:

tar -xzvf frp_0.44.0_linux_amd64.tar.gz 

移除客户端相关配置:

rm -f frpc*

修改frps.ini文件,修改配置如下:

[common]
bind_port = 7000
dashboard_port = 7500
token = 41f1a553fd725468436eeac92425285f9accbd21e31325575ee27ab1ea928931
dashboard_user = root
dashboard_pwd = admin

配置systemctl来控制frps:

sudo vim /lib/systemd/system/frps.service

配置如下:

[Unit]
Description=frps service
After=network.target syslog.target
Wants=network.target

[Service]
Type=simple
#启动服务的命令(此处写你的frps的实际安装目录)
ExecStart=/data/frp/frps -c /data/frp/frps.ini

[Install]
WantedBy=multi-user.target

启动:

## 启动
sudo systemctl start frps
## 开机自启
sudo systemctl enable frps

访问:http://$open in new window:7500,注意需要开放7500和7000端口,输入配置的账号密码即可。

客户端安装

下载链接:点我open in new window

解压配置frpc.inc文件:

[common]
server_addr = 你的服务器ip
server_port = 7000
token = 41f1a553fd725468436eeac92425285f9accbd21e31325575ee27ab1ea928931

[web]
type = http
local_port = 29980
custom_domains = 你的服务器ip
[rdp]
type = tcp
local_ip = 127.0.0.1           
local_port = 3389
remote_port = 7001  
[smb]
type = tcp
local_ip = 127.0.0.1
local_port = 445
remote_port = 7002
[web1]
type = tcp
local_port = 29980
local_ip = 127.0.0.1
remote_port = 29980
[web2]
type = tcp
local_port = 12302
local_ip = 127.0.0.1
remote_port = 12302

添加启动BAT,放到frpc目录:

@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
REM
cd /d %~sdp0
frpc -c frpc.ini
exit

双击运行。

参考链接