Frp内网穿透操作记录
By 辞峡烟斜
突然有一天,家里上不了网。家人不会重启路由器,我就说我远程重启下路由,结果发现不能远程登录。后来回到家,登录路由,竟然发现拨号显示的是100开头的内网地址,如图所示:
十分之郁闷,暂时不想给电信增加麻烦(很伟大吧,哈哈),想着怎么突破大内网的穿透。IPV6不实施,大内网始终是趋势,内网穿透不可避免。
我用的路由器是华硕的AC88U,刷的梅林小宝固件。里面有个“软件中心”,有几个穿透软件,加上自己有个外网VPS,想着逐个试用,顺便学习下内网穿透的内容。花生壳没想用,因为要收点费。试用了ngrok内网穿透,未能成功,具体原因不想追查。因为感觉随带的ngrok不是太规范,VPS重启后还得重新设置运行,有点麻烦,故放弃。本来P2P穿透挺好用,不耗VPS流量,但是没有自行架设P2P穿透服务器的教程,插件原服务器已经不管用。后一番了解知N2N挺不错,但是梅林固件暂时不支持,没法搞。最后的最后,只得试用Frp穿透,没想到一次性成功。以下是步骤:
注:参考 KoolShare 帖子 内网穿透利器Frp一键安装脚本及设置教程 :
一、服务端设置
我的VPS是Debian 8 64bit系统。
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:12.12.12.12 #自动获取你服务器的IP地址
Please input your server setting:
Please input frps bind_port [1-65535][5]: #输入frp提供服务的端口,用于服务器端和客户端通信
Please input frps dashboard_port [1-65535][6]: #输入frp的控制台服务端口,用于查看frp工作状态
Please input frps vhost_http_port [1-65535][7]: #输入frp进行http穿透的http服务端口
Please input frps vhost_https_port [1-65535][8]: #输入frp进行https穿透的https服务端口
Please input privilege_token (Default: WEWLRgwRjIJVPx2kuqzkGnvuftPLQniq): #输入frp服务器和客户端通信的密码,默认是随机生成的
Please input frps max_pool_count [1-200][9]: #设置每个代理可以创建的连接池上限,默认50
Please select log_level
1: info
2: warn
3: error
4: debug
#
Enter your choice (1, 2, 3, 4 or exit. default <a href=“https://pich.yiwan.org/YiWan/201612/1742656792016122519412402.jpg" data-fancybox=“images” class=“cboxElement” rel=“example_group"303>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 <a href=“https://pich.yiwan.org/YiWan/201612/1742656792016122519412402.jpg" data-fancybox=“images” class=“cboxElement” rel=“example_group"303>1): #设置是否开启日志记录,默认开启,开启后日志等级及保留天数生效,否则等级和保留天数无效
设置完成后检查你的输入,如果没有问题按任意键继续安装
============ Check your input ============
You Server IP : 12.12.12.12
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
安装结束后显示:
Congratulations, frps install completed!
You Server IP : 12.12.12.12
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://12.12.12.12:6443/ # 这个是frp控制台访问地址
3. 更新命令
- ./install-frps.sh update
4. 卸载命令
- ./install-frps.sh uninstall
5. 管理命令
- /etc/init.d/frps start
- /etc/init.d/frps stop
- /etc/init.d/frps restart
- /etc/init.d/frps status
- /etc/init.d/frps config
- /etc/init.d/frps version
以下是我在VPS上设置运行命令的截图:
![Frps1][10]
![Frps2][11]
![Frps3][12]
二、域名解析设置
设置自己的域名解析,这里假设域名为aaa.com
,为路由器设置二级解析frho.aaa.com
,设置如下:
![Frps4][13]
三、客户端设置
这里的客户端是我的AC88U路由器,打开“软件中心”,安装开启Frpc穿透插件,设置如下:
![Frps5][14]
![Frps6][15]
穿透成功后,http的访问地址为:
http:// 你设置的域名:远程主机端口。示例中的访问地址就是http:// ac88u.frho.aaa.com:55080 。
[5]: Default Server Port: 5443 [6]: Default dashboard_port: 6443 [7]: Default vhost_http_port: 80 [8]: Default vhost_https_port: 443 [9]: Default max_pool_count: 50 [10]: https://pich.yiwan.org/YiWan/201612/1742656792016122519412402.jpg [11]: https://pich.yiwan.org/YiWan/201612/17426567920161225194158059.jpg [12]: https://pich.yiwan.org/YiWan/201612/17426567920161225194224093.jpg [13]: https://pich.yiwan.org/YiWan/201612/17426567920161225194325083.jpg [14]: https://pich.yiwan.org/YiWan/201612/17426567920161225194348057.jpg [15]: https://pich.yiwan.org/YiWan/201612/17426567920161225194428027.jpg