1

【点滴记录】宝塔使用frp配置内网穿透

 2 years ago
source link: https://blog.jixiaob.cn/?post=71
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
【点滴记录】宝塔使用frp配置内网穿透 - 赵苦瓜のBlog
欢迎食用『【点滴记录】宝塔使用frp配置内网穿透』~,这里是赵苦瓜的看板娘desu~
欢迎来到赵苦瓜のBlog~!
【点滴记录】宝塔使用frp配置内网穿透

首页 > 点滴记录    作者:赵苦瓜   2021年10月19日 19:15 星期二   热度:1160°   百度已收录

 

根据国家政策,不允许运营商提供IPV4公网地址给家庭宽带用户。于是,我就想着搞一个frp内网穿透玩玩。

frp的Github上的release页面:

Releases · fatedier/frp (github.com)

首先,在宝塔上配置frp服务端。

打开上方的release页面,根据服务器系统选择下载程序。我选择的是frp_0.37.1_linux_amd64.tar.gz

之后将文件上传到服务器,解压缩(可以使用宝塔面板的文件上传)

因为服务器上是服务端,所以需要使用的是frps(s即server服务端,c即client客户端)

我们修改一下frps.ini的配置文件,设置监听端口(默认7000)

同时需要在宝塔的安全里面还要对应服务器商的安全组里面放行对应的端口。

之后在这个目录下启动终端,输入

  1. nohup ./frps -c ./frps.ini

即可在后台开启服务。

接着配置客户端。

同样还是打开上方的release页面,根据自己电脑的系统选择下载程序。我选择的是frp_0.37.1_windows_amd64.zip

同样的,解压缩,然后修改配置文件。因为这是客户端,所以修改的配置文件为frpc.ini

  1. [common]
  2. # 服务端的公网IP地址。
  3. server_addr = 8.8.8.8
  4. # 服务端的监听端口
  5. server_port = 7000
  6. [ssh]
  7. type = tcp
  8. # 内网IP地址
  9. local_ip = 127.0.0.1
  10. # 本机需要映射的端口
  11. local_port = 22
  12. # 外网通过服务端访问所需要的端口,同样也需要在对应安全组里面放行端口
  13. remote_port = 6000

之后,保存配置文件,便可以启动服务了。

同样在这个目录下,按住shift并右键文件夹空白处,选择“在此处打开Powershell窗口”

然后输入./frpc -c ./frpc.ini 即可启动客户端。显示start proxy success 即是启动成功了。

  1. PS E:\Program Files\frp_0.37.1_windows_amd64> ./frpc -c ./frpc.ini
  2. 2021/10/19 19:36:47 [I] [service.go:304] [281426e345363dc6] login to server success, get run id [281426e345363dc6], server udp port [0]
  3. 2021/10/19 19:36:47 [I] [proxy_manager.go:144] [281426e345363dc6] proxy added: [ssh]
  4. 2021/10/19 19:36:47 [I] [control.go:180] [281426e345363dc6] [ssh] start proxy success

另外有可能会遇到这个错误:

ERR_UNSAFE_PORT

这是由于端口在浏览器的非安全端口列表中。搭网站时要尽量避免这些端口。

  1. 1, // tcpmux
  2. 7, // echo
  3. 9, // discard
  4. 11, // systat
  5. 13, // daytime
  6. 15, // netstat
  7. 17, // qotd
  8. 19, // chargen
  9. 20, // ftp data
  10. 21, // ftp access
  11. 22, // ssh
  12. 23, // telnet
  13. 25, // smtp
  14. 37, // time
  15. 42, // name
  16. 43, // nicname
  17. 53, // domain
  18. 77, // priv-rjs
  19. 79, // finger
  20. 87, // ttylink
  21. 95, // supdup
  22. 101, // hostriame
  23. 102, // iso-tsap
  24. 103, // gppitnp
  25. 104, // acr-nema
  26. 109, // pop2
  27. 110, // pop3
  28. 111, // sunrpc
  29. 113, // auth
  30. 115, // sftp
  31. 117, // uucp-path
  32. 119, // nntp
  33. 123, // NTP
  34. 135, // loc-srv /epmap
  35. 139, // netbios
  36. 143, // imap2
  37. 179, // BGP
  38. 389, // ldap
  39. 465, // smtp+ssl
  40. 512, // print / exec
  41. 513, // login
  42. 514, // shell
  43. 515, // printer
  44. 526, // tempo
  45. 530, // courier
  46. 531, // chat
  47. 532, // netnews
  48. 540, // uucp
  49. 556, // remotefs
  50. 563, // nntp+ssl
  51. 587, // stmp?
  52. 601, // ??
  53. 636, // ldap+ssl
  54. 993, // ldap+ssl
  55. 995, // pop3+ssl
  56. 2049, // nfs
  57. 3659, // apple-sasl / PasswordServer
  58. 4045, // lockd
  59. 6000, // X11
  60. 6665, // Alternate IRC [Apple addition]
  61. 6666, // Alternate IRC [Apple addition]
  62. 6667, // Standard IRC [Apple addition]
  63. 6668, // Alternate IRC [Apple addition]
  64. 6669, // Alternate IRC [Apple addition]
如果不能更改端口号还想访问,具体方法详见这篇博文:

ERR_UNSAFE_PORT浏览器安全问题无法访问的解决方案_kjcxmx的博客-CSDN博客_err_unsafe_port


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK