frp使用教程
# FRP使用教程
使用FRP实现Windows远程桌面,内网穿透
tips:
1.不差钱的可以买带宽大点的服务器
2.新建服务器入站规则时,一定要一个端口一个端口建,尝试过端口端建规则,结果折腾了两天没成功,差点放弃
3.frp的KCP方式还在研究,据说握手后就能直连了,速度会快不少
4.Ubuntu系统,版本16以上
5.关闭window客户端防火墙,服务器防火墙和云服务商同时放行对应的端口
1
2
3
4
5
6
2
3
4
5
6
# 软件下载
# FRP服务器端安装
- 将下载的文件上传到服务器并完成解压
- 配置frps.ini 文件
- 运行frp
- 配置开机启动
- 将下载的文件上传到服务器并完成解压
可以使用xsheel或者finalShell等工具将下载的文件上传到服务器上并进行解压
解压命令:
tar -zxvf frp_0.32.0_linux_amd64.tar.gz
1
给解压后的frp文件夹授权
sudo chmod -R 777 /root/frp
1
- 配置frps.ini 文件
到frp的解压目录下,然后使用vi frps.ini进行编辑
解释:
#服务器的ip地址 使用0.0.0.0也可以
bind_addr = 0.0.0.0
#客户端和服务器通讯的端口
bind_port = 7000
#客户端和服务器通讯的密钥,可以自己随便定义
auto_token = 12345678
#可视化界面管理端口号
dashboard_port = 7800
#可视化界面管理登录用户名
dashboard_user = admin
#可视化界面管理登录密码
dashboard_pwd = 12345678
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
完整内容如下:
[common]
bind_addr = 0.0.0.0
bind_port = 7000
auto_token = 12345678
dashboard_port = 7800
dashboard_user = admin
dashboard_pwd = 12345678
1
2
3
4
5
6
7
2
3
4
5
6
7
- 运行frp
./frps -c ./frps.ini
1
2
2
- 配置开机启动
执行命令:
vi /etc/systemd/system/frps.service
1
2
2
然后内容如下:
[Unit]
Description=frps daemon
After=syslog.target network.target
Wants=network.target
[Service]
Type=simple
ExecStart=/root/frp/frps -c /root/frp/frps.ini
Restart= always
RestartSec=1min
[Install]
WantedBy=multi-user.target
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
ExecStart=/root/frp/frps -c /root/frp/frps.ini
为你frp的真实目录
按ESC退出编辑模式,输入:wq 保存并退出
启动frps
systemctl start frps
1
将frps设置为开机启动
systemctl enable frps
1
# 客户端配置
- 解压文件到相应目录下
- 对frpc.ini进行配置
- 设置开机启动
- 设置客户端远程桌面
- 解压文件到相应目录下
这个步骤不在进行赘述
- 对frpc.ini进行配置
解释:
[common]
#你服务器的ip地址
server_addr = 182.*.*.*
#你服务器frps.ini中配置的bind_port端口
server_port = 7000
#你服务器frps.ini中配置的auto_token
auto_token = 12345678
tls_enable = true
#隧道名称,不同电脑隧道名称不相同
[rdp-bty]
type = tcp
#本机地址,默认是127.0.0.1
local_ip = 127.0.0.1
#远程桌面端口
local_port = 3389
#访问远程桌面需要输入的端口,和服务器没有关联
remote_port = 2288
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
以上配置远程访问地址为:server_addr:remote_port
完整配置如下:
[common]
server_addr = 182.*.*.*
server_port = 7000
auto_token = 12345678
tls_enable = true
[rdp-bty]
type = tcp
local_ip = 127.0.0.1
local_port = 3389
remote_port = 3588
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
- 设置开机启动
下载winsw (opens new window)最新版,为了方便将其重命名为winsw.exe, 将该文件和frpc.exe放在一起,然后新建winsw.xml
写入以下内容:
<service>
<id>frp</id>
<name>frp</name>
<description>用frp发布本地电脑网站到外网</description>
<executable>frpc</executable>
<arguments>-c frpc.ini</arguments>
<logmode>reset</logmode>
</service>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
保存后进入powershell,CD到frp所在目录,然后使用
winsw install
1
和
frpc start
1
命令即可将frpc安装为系统服务。 win+r后通过
services.msc
1
进入到服务列表页面找到frp服务。 为了确保frpc在连接失败后自动尝试重新连接,在恢复tap页进行如下设置: 完成后下次启动系统,服务就会自动启动运行。
- 设置客户端远程桌面
# 通过Windows远程桌面连接到受控客户端
通过开始菜单打开远程桌面程序 点连接后输入受控端电脑的用户名密码即可登录 如果提示无法连接,请检查受控端远程桌面设置是否有问题,尝试关闭受控端防火墙,如果还是无法连接请跟换端口,并在服务器安全组中把更改后的端口号写入入站规则
Last Updated: 2023/08/03, 11:01:11