通过 frp 实现内网穿透

发布于 2020-08-13  381 次阅读


中文 英文 韩语 日语

学校有个装了 HomeAssistant 的 NUC 小电脑,因为没有独立 ip,当人在外的时候没法直接通过远程访问。通过使用 frp 和一个具有公网 ip 的服务器就可以实现内网穿透,实现在任何地方都可以直接登陆 NUC 小电脑。
1. 服务器端配置

wget --no-check-certificate https://raw.githubusercontent.com/clangcn/onekey-install-shell/master/frps/install-frps.sh -O ./install-frps.sh
chmod 700 ./install-frps.sh
./install-frps.sh install

2. 具体配置

Loading network version for frps, please wait...
frps Latest release file frp_0.8.1_linux_amd64.tar.gz    #此步骤会自动获取frp最新版本,自动操作,无需理会
Loading You Server IP, please wait...
You Server IP:172.16.2.166                                           #自动获取你服务器的IP地址
Please input your server setting:
Please input frps bind_port [1-65535](Default Server Port: 5443):      #输入frp提供服务的端口,用于服务器端和客户端通信
Please input frps dashboard_port [1-65535](Default dashboard_port: 6443): #输入frp的控制台服务端口,用于查看frp工作状态
Please input frps vhost_http_port [1-65535](Default vhost_http_port: 80):  #输入frp进行http穿透的http服务端口
Please input frps vhost_https_port [1-65535](Default vhost_https_port: 443): #输入frp进行https穿透的https服务端口
Please input privilege_token (Default: WEWLRgwRjIJVPx2kuqzkGnvuftPLQniq): #输入frp服务器和客户端通信的密码,默认是随机生成的
Please input frps max_pool_count [1-200](Default max_pool_count: 50):     #设置每个代理可以创建的连接池上限,默认50
##### Please select log_level #####
1: info
2: warn
3: error
4: debug
#####################################################
Enter your choice (1, 2, 3, 4 or exit. default [1]):        #设置日志等级,4个选项,默认是info
Please input frps log_max_days [1-30]
(Default log_max_days: 3 day):            #设置日志保留天数,范围是1到30天,默认保留3天。
##### Please select log_file #####
1: enable
2: disable
#####################################################
Enter your choice (1, 2 or exit. default [1]):      #设置是否开启日志记录,默认开启,开启后日志等级及保留天数生效,否则等级和保留天数无效

3. 设置完成后检查你的输入,如果没有问题按任意键继续安装

============== Check your input ==============
You Server IP   : 172.16.2.166
Bind port       : 5443
Dashboard port  : 6443
vhost http port : 80
vhost https port: 443
Privilege token : WEWLRgwRjIJVPx2kuqzkGnvuftPLQniq
Max Pool count  : 50
Log level       : info
Log max days    : 3
Log file        : enable
==============================================

4. 安装结束后显示刚才的具体配置

Congratulations, frps install completed!
==============================================
You Server IP   : 172.16.2.166
Bind port       : 5443
Dashboard port  : 6443
vhost http port : 80
vhost https port: 443
Privilege token : WEWLRgwRjIJVPx2kuqzkGnvuftPLQniq
Max Pool count  : 50
Log level       : info
Log max days    : 3
Log file        : enable           #  将上面信息添加到你的路由器frp穿透插件中吧
==============================================
frps Dashboard: http://172.16.2.166:6443/   #  这个是frp控制台访问地址
==============================================

5. 更新命令

./install-frps.sh update

6. 卸载命令

./install-frps.sh uninstall

7. 服务端管理命令

frps start
frps stop
frps restart
frps status
frps config
frps version

8. 客户端配置(我这边是以 padavan 固件为例,因为它集成了 frp 客户端)
只需要修改客户端的配置即可,配置玩后启用 frp 内网穿透和 frpc 客户端
router.png教程

原文:https://taron.top/archives/6.html


一个追求爱搞的小逗逼