Skip to content

内网穿透的几种姿势

L edited this page Nov 19, 2018 · 4 revisions

解决方案有frp,花生壳,ngrok等

frp

源代码
https://github.com/fatedier/frp   
说明文档
https://github.com/fatedier/frp/blob/master/README_zh.md

这个需要自己有VPS和域名
不支持IIS Express发布的站点

下载

https://github.com/fatedier/frp/releases
根据自己的服务器系统下载对应的包

server

配置

[common]
# 一个空置的端口,用来启动
bind_port = 11112
vhost_http_port = 11111
# custom_domains and subdomain_host 至少设置一个
# subdomain_host = xxxxx.com

cmd/power shell启动,注意选择config

frps.exe -c frps.ini
注意事项

1.报错:An attempt was made to access a socket in a way forbidden by its access permissions
->端口被占用
2.防火墙、出入站规则
3.设置Windows开机自启动frp服务器

client

[common]
# 公网ip
server_addr = x.x.x.x
server_port = 11112
[web]
type = http
# 本地指向端口号
local_port = 1107
# custom_domains and subdomain_host 至少设置一个
# 需要将域名指向server机
custom_domains = xxxxx.com
use_encryption = true
use_compression = true

cmd/power shell启动

frpc.exe -c frpc.ini

参考资料

https://www.zhangfangzhou.cn/use-frp-for-linux-windows.html

花生壳

之前一直在用,不过免费的花生壳现在只给动态随机端口了,没有以前方便,比如调试微信需要80端口

ngrok

https://www.ngrok.cc/

Clone this wiki locally