一.钉钉内网穿透(难度低)
第一步:git下载钉钉内网穿透工具
第二步:开启内网穿透
进入ding.exe所在目录
打开cmd,输入命令 .\ding -config=.\ding.cfg -subdomain=guixiansong 8080
第三步:自己写代码测试
二.frp内网穿透(难度高)
下载工具
对应linux和windows下载对应版本的软件。
以下是frps.ini和frpc.ini文件的配置:
服务器
[common]
bind_port = 7000
#服务端仪表板的端口
dashboard_port= 7500
#仪表板页面登录的用户名
dashboard_user= admin
#仪表板页面登录的密码
dashboard_pwd= *31
vhost_http_port= 808
vhost_https_port = 4438
客户端
[common]
server_addr = guixians*.xyz
; server_addr = 101.32.26.181
server_port = 7000
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 600
[redis]
type = tcp
local_ip = 127.0.0.1
local_port = 6666
remote_port = 6000
[webtest]
type=http
local_ip=127.0.0.1
local_port = 8080
custom_domains = guixians*.xyz
[webtest_app1]
type=http
local_ip=127.0.0.1
local_port = 8081
custom_domains = app1.guixia*.xyz
[webtest_app2]
type=http
local_ip=127.0.0.1
local_port = 8082
custom_domains = app2.guixi*.xyz
[webtest_app3]
type=http
local_ip=127.0.0.1
local_port = 8083
custom_domains = app3.guixia*.xyz
启动办法
服务器:./frps -c frps.ini &
-c 附带配置文件
& 隐身执行,不在当前窗口显示
端口对应:根据域名对应各自端口
设置成windows服务
1.去GitHub上下载该.exe文件
2.放到frpc.exe同一目录下
3.创建WinSW-x64.xml文件
<service>
<id>frp</id>
<name>frp</name>
<description>用frp发布本地电脑网站到外网</description>
<executable>frpc</executable>
<arguments>-c frpc.ini</arguments>
<logmode>reset</logmode>
</service>
4.执行 WinSW-x64 install 和 frpc.exe 命令,出现下图表示成功。
5.设置frp服务的“恢复”属性
将服务端设置成linux服务
(这部分内容转载自:
版权声明:解决frp使用过程中总是断掉的问题 来源于网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/momo_mutou/article/details/85000056
)
我们在 /lib/systemd/system 目录下创建一个文件frps.service ,
内容如下图所示
[unit]
Description=frps service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
#启动服务的命令(此处写frps的实际安装目录)
ExecStart=/root/frp_0.36.2_linux_amd64/frps -c /root/frp_0.36.2_linux_amd64/frps.ini
[Install]
WantedBy=multi-user.target
启动frps
sudo systemctl start frps
打开自启动
sudo systemctl enable frps
重启应用
sudo systemctl restart frps
停止应用
sudo systemctl stop frps
查看应用的日志
sudo systemctl status frps