因为工作的原因,平时都是用linux系统部署软件,但是我的IP代理服务器是windows系统的,所以这两种系统我都研究了一下如何搭建frp内网穿透服务端。
windows服务端部署

1 - 0f26a2fae65e06c-2.jpg

1.把压缩包解压后,将以下配置复制到服务端配置文件,即frps.ini文件
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">[</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">common</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">]</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  2. bind_addr </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">0.0</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">0.0</span></span><span class="pln" style="box-sizing: border-box;">

  3. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#服务端运行端口,可以自定义1-65535之间即可</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  4. bind_port </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">9527</span></span><span class="pln" style="box-sizing: border-box;">

  5. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#dashboard WEB控制台登录用户名,可以自定义</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  6. dashboard_user </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;"> admin

  7. </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#dashboard WEB控制台登录密码</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  8. dashboard_pwd </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">12345</span></span><span class="pln" style="box-sizing: border-box;">

  9. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#dashboard WEB控制台端口,可以自定义1-65535之间即可,启动后通过浏览器访问如http://ip:8080</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  10. dashboard_port </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">8080</span></span><span class="pln" style="box-sizing: border-box;">

  11. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#设置客户端token,对应客户端的token配置,作用类似密码验证,可以自定义</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  12. token </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">123456789</span></span></font>
复制代码

2.WIN+R输入cmd,打开命令提示符

2 - fad4b385baaddbb-2.jpg

3.复制服务端路径

3 - 618ac07bcd73f91-2.jpg

4.在命令提示符中输入cd 路径后回车,在输入 frps.exe -c frps.ini后回车

4 - 240c3a15f0e50f7-2.jpg

5.浏览器输入服务端IP:端口,查看是否部署成功,例如:

5 - c0d532c978cbd35-1.jpg

备注:服务器开放防火墙TCP的8080,9090,9527端口
CentOs 7.3服务端部署
1.使用CRT或者Xshell等工具连上服务器后,切换至/usr/local路径
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">cd </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">usr</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="kwd" style="box-sizing: border-box;"><span class="kwd" style="box-sizing: border-box;">local</span></span></font>
复制代码

1.在 /usr/local目录下,输入rz并按下回车键,选择安装包进行上传
  1. <font size="2" color="#000000" style="background-color: white;">rz</font>
复制代码

3.解压安装包
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">tar </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">-</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">zxvf frp_0</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">37.1</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">_linux_amd64</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">tar</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">gz</span></span></font>
复制代码

4.重命名解压后的目录,方便后面填写路径
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">mv frp_0</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">37.1</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">_linux_amd64 frp</span></span></font>
复制代码

5.编辑frps.ini文件
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">vi </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">usr</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="kwd" style="box-sizing: border-box;"><span class="kwd" style="box-sizing: border-box;">local</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">frp</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">frps</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">ini</span></span></font>
复制代码

6.先按下“i”键进入输入模式,将以下内容复制进去,,按下“esc”键,再按下“:”键,输入“wq!”后回车。
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">[</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">common</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">]</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  2. bind_addr </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">0.0</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">0.0</span></span><span class="pln" style="box-sizing: border-box;">

  3. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#服务器代理端口</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  4. bind_port </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">9527</span></span><span class="pln" style="box-sizing: border-box;">

  5. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#与客户端进行校验的令牌</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  6. token </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">123456789</span></span><span class="pln" style="box-sizing: border-box;">

  7. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#控制面板的账号</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  8. dashboard_user </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;"> admin

  9. </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#控制面板的密码</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  10. dashboard_pwd </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;"> admin123

  11. </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#控制面板端口号</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  12. dashboard_port </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">8080</span></span></font>
复制代码

7.启动frp服务
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="str" style="box-sizing: border-box;"><span class="str" style="box-sizing: border-box;">/frps -c ./</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">frps</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">ini</span></span></font>
复制代码

8.添加systemd配置文件,不然每次服务器重启后都要手动启动服务
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">vim </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">usr</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">lib</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">systemd</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">system</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">frps</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">service</span></span></font>
复制代码

9.先按下“i”键进入输入模式,将以下内容复制进去,,按下“esc”键,再按下“:”键,输入“wq!”后回车。
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">[</span></span><span class="typ" style="box-sizing: border-box;"><span class="typ" style="box-sizing: border-box;">Unit</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">]</span></span><span class="pln" style="box-sizing: border-box;">
  2. </span><span class="typ" style="box-sizing: border-box;"><span class="typ" style="box-sizing: border-box;">Description</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">frps
  3. </span></span><span class="typ" style="box-sizing: border-box;"><span class="typ" style="box-sizing: border-box;">After</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">network</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">target

  4. </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">[</span></span><span class="typ" style="box-sizing: border-box;"><span class="typ" style="box-sizing: border-box;">Service</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">]</span></span><span class="pln" style="box-sizing: border-box;">
  5. </span><span class="typ" style="box-sizing: border-box;"><span class="typ" style="box-sizing: border-box;">TimeoutStartSec</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">30</span></span><span class="pln" style="box-sizing: border-box;">
  6. </span><span class="typ" style="box-sizing: border-box;"><span class="typ" style="box-sizing: border-box;">ExecStart</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="str" style="box-sizing: border-box;"><span class="str" style="box-sizing: border-box;">/usr/</span></span><span class="kwd" style="box-sizing: border-box;"><span class="kwd" style="box-sizing: border-box;">local</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">frp</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">frps </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">-</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">c </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">usr</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="kwd" style="box-sizing: border-box;"><span class="kwd" style="box-sizing: border-box;">local</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">frp</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">frps</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">ini
  7. </span></span><span class="typ" style="box-sizing: border-box;"><span class="typ" style="box-sizing: border-box;">ExecStop</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="str" style="box-sizing: border-box;"><span class="str" style="box-sizing: border-box;">/bin/</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">kill $MAINPID

  8. </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">[</span></span><span class="typ" style="box-sizing: border-box;"><span class="typ" style="box-sizing: border-box;">Install</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">]</span></span><span class="pln" style="box-sizing: border-box;">
  9. </span><span class="typ" style="box-sizing: border-box;"><span class="typ" style="box-sizing: border-box;">WantedBy</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">multi</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">-</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">user</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">target</span></span></font>
复制代码

10.设置开机启动
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">systemctl daemon</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">-</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">reload
  2. systemctl enable frp</span></span></font>
复制代码

11.启动frp服务端
  1. <font size="2" color="#000000" style="background-color: white;">systemctl start frp</font>
复制代码

12.检查服务是否运行起来,看下有没有返回值,有的话,说明成功了。成功了最好重启服务器再验证一下
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">ps </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">-</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">aux </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">|</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;"> grep frps</span></span></font>
复制代码

备注:服务器开放防火墙TCP的8080,9090,9527端口
客户端配置
1.把压缩包解压后,将以下配置复制到客户端配置文件,即frpc.ini文件,如果有多台PC需要远程,就把remote_port改成不一样的,比如A电脑配置为9090,B电脑配置为9091,C电脑配置为9092……..
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">[</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">common</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">]</span></span><span class="pln" style="box-sizing: border-box;">

  2. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;"># 配置服务器IP地址</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  3. server_addr </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">这里填服务器</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">IP

  4. </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#配置服务端监听的端口,与服务端的bind_port端口保持一致</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  5. server_port </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">9527</span></span><span class="pln" style="box-sizing: border-box;">

  6. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#服务端配置token,将服务端配置的token复制到此处</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  7. token </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">123456789</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  8. pool_count </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">5</span></span><span class="pln" style="box-sizing: border-box;">

  9. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#这里是配置端口范围转发</span></span><span class="pln" style="box-sizing: border-box;">

  10. </span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">[</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">range</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">:</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">services</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">]</span></span><span class="pln" style="box-sizing: border-box;">

  11. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#类型为tcp</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  12. type </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;"> tcp

  13. </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#本地ip地址通常为127.0.0.1</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  14. local_ip </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">127.0</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">0.1</span></span><span class="pln" style="box-sizing: border-box;">

  15. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#本机的远程端口,默认为3389</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">

  16. local_port </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">3389</span></span><span class="pln" style="box-sizing: border-box;">

  17. </span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">#映射到服务端的端口范围(公网服务器可用的端口,1-66535)</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  18. remote_port </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">=</span></span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">9090</span></span></font>
复制代码

2.在命令提示符中执行 frpc.exe -c frpc.ini即可,操作步骤和服务端配置步骤2-3相似

6 - ad7bb7a4e43551a-1.jpg

3.任务管理器中查看是否有这项进程

7 - 530c64d9b8fe5ff-1.jpg

最后就可以通过服务器IP+端口远程到内网的电脑上了,例如我映射的端口是9090,那就是服务器IP:9090进行访问。

8 - e3fbbd79a8ef70b-1.jpg

Windows客户端/服务端开机自启
方法一:
1.编辑文件winsw.xml,将路径替换为文件所在路径,如果是服务端就把frpc.exe更改为frps.exe

9 - 0f43260409023c6-1.jpg

2.管理员模式运行命令提示符,切到到文件路径后,执行 winsw.exe install

10 - 10618b18bea54c8-1.jpg

3.检查服务是否启动

11 - 1012790c92e0441-1.jpg

4.操作指令
  1. <font size="2" color="#000000" style="background-color: white;"><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">winsw</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">exe install    </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">//注册</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  2. winsw</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">exe uninstall  </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">//卸载</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  3. winsw</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">exe start      </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">//启动</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  4. winsw</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">exe stop       </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">//停止</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  5. winsw</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">exe restart    </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">//重启</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  6. winsw</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">exe status     </span></span><span class="com" style="box-sizing: border-box;"><span class="com" style="box-sizing: border-box;">//查看状态</span></span></font>
复制代码

方法二:
1.在frp 目录下,新建一个start.bat的文件,复制下面内容进去,最下面“D:\FRP\”是绝对路径,根据自己的情况进行替换,如果是服务端就把frpc.exe更改为frps.exe
  1. <font size="2" color="#000000" style="background-color: white;"><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">@echo</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;"> off
  2. </span></span><span class="kwd" style="box-sizing: border-box;"><span class="kwd" style="box-sizing: border-box;">if</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="str" style="box-sizing: border-box;"><span class="str" style="box-sizing: border-box;">"%1"</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">==</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="str" style="box-sizing: border-box;"><span class="str" style="box-sizing: border-box;">"h"</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="kwd" style="box-sizing: border-box;"><span class="kwd" style="box-sizing: border-box;">goto</span></span><span class="pln" style="box-sizing: border-box;"> </span><span class="kwd" style="box-sizing: border-box;"><span class="kwd" style="box-sizing: border-box;">begin</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  3. mshta vbscript</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">:</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">createobject</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">(</span></span><span class="str" style="box-sizing: border-box;"><span class="str" style="box-sizing: border-box;">"wscript.shell"</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">).</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">run</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">(</span></span><span class="str" style="box-sizing: border-box;"><span class="str" style="box-sizing: border-box;">"""%~nx0"" h"</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">,</span></span><span class="lit" style="box-sizing: border-box;"><span class="lit" style="box-sizing: border-box;">0</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">)(</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">window</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">close</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">)&&</span></span><span class="kwd" style="box-sizing: border-box;"><span class="kwd" style="box-sizing: border-box;">exit</span></span><span class="pln" style="box-sizing: border-box;">
  4. </span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">:</span></span><span class="kwd" style="box-sizing: border-box;"><span class="kwd" style="box-sizing: border-box;">begin</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">
  5. D</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">:</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">\FRP\frpc</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">exe </span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">-</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">c D</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">:</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">\FRP\frpc</span></span><span class="pun" style="box-sizing: border-box;"><span class="pun" style="box-sizing: border-box;">.</span></span><span class="pln" style="box-sizing: border-box;"><span class="pln" style="box-sizing: border-box;">ini</span></span></font>
复制代码

2.加start.bat添加进开机服务,右键【此电脑】-【管理】-【任务计划程序】-【创建任务】,并按如下操作,然后确定即可。

12 - 0f26a2fae65e06c-3.jpg


13 - fad4b385baaddbb-3.jpg


14 - 618ac07bcd73f91-3.jpg


15 - d5bf28e99cd9ddd-1.jpg


16 - 240c3a15f0e50f7-3.jpg







管理登录|网站声明|1999-2022|电脑小百科 ( 蜀ICP备15008940号-1 )

返回顶部