【点滴记录】宝塔使用frp配置内网穿透
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.
根据国家政策,不允许运营商提供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)
同时需要在宝塔的安全里面还要对应服务器商的安全组里面放行对应的端口。
之后在这个目录下启动终端,输入
- nohup ./frps -c ./frps.ini
即可在后台开启服务。
接着配置客户端。
同样还是打开上方的release页面,根据自己电脑的系统选择下载程序。我选择的是frp_0.37.1_windows_amd64.zip
同样的,解压缩,然后修改配置文件。因为这是客户端,所以修改的配置文件为frpc.ini
- [common]
- # 服务端的公网IP地址。
- server_addr = 8.8.8.8
- # 服务端的监听端口
- server_port = 7000
- [ssh]
- type = tcp
- # 内网IP地址
- local_ip = 127.0.0.1
- # 本机需要映射的端口
- local_port = 22
- # 外网通过服务端访问所需要的端口,同样也需要在对应安全组里面放行端口
- remote_port = 6000
之后,保存配置文件,便可以启动服务了。
同样在这个目录下,按住shift并右键文件夹空白处,选择“在此处打开Powershell窗口”
然后输入./frpc -c ./frpc.ini 即可启动客户端。显示start proxy success 即是启动成功了。
- PS E:\Program Files\frp_0.37.1_windows_amd64> ./frpc -c ./frpc.ini
- 2021/10/19 19:36:47 [I] [service.go:304] [281426e345363dc6] login to server success, get run id [281426e345363dc6], server udp port [0]
- 2021/10/19 19:36:47 [I] [proxy_manager.go:144] [281426e345363dc6] proxy added: [ssh]
- 2021/10/19 19:36:47 [I] [control.go:180] [281426e345363dc6] [ssh] start proxy success
另外有可能会遇到这个错误:
ERR_UNSAFE_PORT
这是由于端口在浏览器的非安全端口列表中。搭网站时要尽量避免这些端口。
- 1, // tcpmux
- 7, // echo
- 9, // discard
- 11, // systat
- 13, // daytime
- 15, // netstat
- 17, // qotd
- 19, // chargen
- 20, // ftp data
- 21, // ftp access
- 22, // ssh
- 23, // telnet
- 25, // smtp
- 37, // time
- 42, // name
- 43, // nicname
- 53, // domain
- 77, // priv-rjs
- 79, // finger
- 87, // ttylink
- 95, // supdup
- 101, // hostriame
- 102, // iso-tsap
- 103, // gppitnp
- 104, // acr-nema
- 109, // pop2
- 110, // pop3
- 111, // sunrpc
- 113, // auth
- 115, // sftp
- 117, // uucp-path
- 119, // nntp
- 123, // NTP
- 135, // loc-srv /epmap
- 139, // netbios
- 143, // imap2
- 179, // BGP
- 389, // ldap
- 465, // smtp+ssl
- 512, // print / exec
- 513, // login
- 514, // shell
- 515, // printer
- 526, // tempo
- 530, // courier
- 531, // chat
- 532, // netnews
- 540, // uucp
- 556, // remotefs
- 563, // nntp+ssl
- 587, // stmp?
- 601, // ??
- 636, // ldap+ssl
- 993, // ldap+ssl
- 995, // pop3+ssl
- 2049, // nfs
- 3659, // apple-sasl / PasswordServer
- 4045, // lockd
- 6000, // X11
- 6665, // Alternate IRC [Apple addition]
- 6666, // Alternate IRC [Apple addition]
- 6667, // Standard IRC [Apple addition]
- 6668, // Alternate IRC [Apple addition]
- 6669, // Alternate IRC [Apple addition]
ERR_UNSAFE_PORT浏览器安全问题无法访问的解决方案_kjcxmx的博客-CSDN博客_err_unsafe_port
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK